2 //===----------------------- initializer_list -----------------------------===//
4 // The LLVM Compiler Infrastructure
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
9 //===----------------------------------------------------------------------===//
11 #ifndef _LIBCPP_INITIALIZER_LIST
12 #define _LIBCPP_INITIALIZER_LIST
15 initializer_list synopsis
21 class initializer_list
25 typedef const E& reference;
26 typedef const E& const_reference;
27 typedef size_t size_type;
29 typedef const E* iterator;
30 typedef const E* const_iterator;
32 initializer_list() noexcept; // constexpr in C++14
34 size_t size() const noexcept; // constexpr in C++14
35 const E* begin() const noexcept; // constexpr in C++14
36 const E* end() const noexcept; // constexpr in C++14
39 template<class E> const E* begin(initializer_list<E> il) noexcept; // constexpr in C++14
40 template<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in C++14
49 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
50 #pragma GCC system_header
53 namespace std // purposefully not versioned
56 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
59 class _LIBCPP_TYPE_VIS_ONLY initializer_list
65 _LIBCPP_CONSTEXPR_AFTER_CXX11
66 initializer_list(const _Ep* __b, size_t __s) _NOEXCEPT
71 typedef _Ep value_type;
72 typedef const _Ep& reference;
73 typedef const _Ep& const_reference;
74 typedef size_t size_type;
76 typedef const _Ep* iterator;
77 typedef const _Ep* const_iterator;
80 _LIBCPP_CONSTEXPR_AFTER_CXX11
81 initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {}
84 _LIBCPP_CONSTEXPR_AFTER_CXX11
85 size_t size() const _NOEXCEPT {return __size_;}
88 _LIBCPP_CONSTEXPR_AFTER_CXX11
89 const _Ep* begin() const _NOEXCEPT {return __begin_;}
92 _LIBCPP_CONSTEXPR_AFTER_CXX11
93 const _Ep* end() const _NOEXCEPT {return __begin_ + __size_;}
97 inline _LIBCPP_INLINE_VISIBILITY
98 _LIBCPP_CONSTEXPR_AFTER_CXX11
100 begin(initializer_list<_Ep> __il) _NOEXCEPT
106 inline _LIBCPP_INLINE_VISIBILITY
107 _LIBCPP_CONSTEXPR_AFTER_CXX11
109 end(initializer_list<_Ep> __il) _NOEXCEPT
114 #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
118 #endif // _LIBCPP_INITIALIZER_LIST