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;
34 size_t size() const noexcept;
35 const E* begin() const noexcept;
36 const E* end() const noexcept;
39 template<class E> const E* begin(initializer_list<E> il) noexcept;
40 template<class E> const E* end(initializer_list<E> il) noexcept;
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 initializer_list
65 initializer_list(const _Ep* __b, size_t __s) _NOEXCEPT
70 typedef _Ep value_type;
71 typedef const _Ep& reference;
72 typedef const _Ep& const_reference;
73 typedef size_t size_type;
75 typedef const _Ep* iterator;
76 typedef const _Ep* const_iterator;
78 _LIBCPP_ALWAYS_INLINE initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {}
80 _LIBCPP_ALWAYS_INLINE size_t size() const _NOEXCEPT {return __size_;}
81 _LIBCPP_ALWAYS_INLINE const _Ep* begin() const _NOEXCEPT {return __begin_;}
82 _LIBCPP_ALWAYS_INLINE const _Ep* end() const _NOEXCEPT {return __begin_ + __size_;}
86 inline _LIBCPP_INLINE_VISIBILITY
88 begin(initializer_list<_Ep> __il) _NOEXCEPT
94 inline _LIBCPP_INLINE_VISIBILITY
96 end(initializer_list<_Ep> __il) _NOEXCEPT
101 #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
105 #endif // _LIBCPP_INITIALIZER_LIST