2 //===----------------------------------------------------------------------===//
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP_INITIALIZER_LIST
11 #define _LIBCPP_INITIALIZER_LIST
14 initializer_list synopsis
20 class initializer_list
24 typedef const E& reference;
25 typedef const E& const_reference;
26 typedef size_t size_type;
28 typedef const E* iterator;
29 typedef const E* const_iterator;
31 initializer_list() noexcept; // constexpr in C++14
33 size_t size() const noexcept; // constexpr in C++14
34 const E* begin() const noexcept; // constexpr in C++14
35 const E* end() const noexcept; // constexpr in C++14
38 template<class E> const E* begin(initializer_list<E> il) noexcept; // constexpr in C++14
39 template<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in C++14
46 #include <__cstddef/size_t.h>
49 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
50 # pragma GCC system_header
53 namespace std // purposefully not versioned
56 #ifndef _LIBCPP_CXX03_LANG
59 class _LIBCPP_TEMPLATE_VIS initializer_list {
63 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 initializer_list(const _Ep* __b, size_t __s) _NOEXCEPT
68 typedef _Ep value_type;
69 typedef const _Ep& reference;
70 typedef const _Ep& const_reference;
71 typedef size_t size_type;
73 typedef const _Ep* iterator;
74 typedef const _Ep* const_iterator;
76 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {}
78 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 size_t size() const _NOEXCEPT { return __size_; }
80 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* begin() const _NOEXCEPT { return __begin_; }
82 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* end() const _NOEXCEPT { return __begin_ + __size_; }
86 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* begin(initializer_list<_Ep> __il) _NOEXCEPT {
91 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* end(initializer_list<_Ep> __il) _NOEXCEPT {
95 #endif // !defined(_LIBCPP_CXX03_LANG)
99 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
103 #endif // _LIBCPP_INITIALIZER_LIST