123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- #ifndef _LIBCPP_INITIALIZER_LIST
- #define _LIBCPP_INITIALIZER_LIST
- #include <__config>
- #include <cstddef>
- #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
- #pragma GCC system_header
- #endif
- namespace std
- {
- #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
- template<class _Ep>
- class _LIBCPP_TYPE_VIS_ONLY initializer_list
- {
- const _Ep* __begin_;
- size_t __size_;
- _LIBCPP_ALWAYS_INLINE
- _LIBCPP_CONSTEXPR_AFTER_CXX11
- initializer_list(const _Ep* __b, size_t __s) _NOEXCEPT
- : __begin_(__b),
- __size_(__s)
- {}
- public:
- typedef _Ep value_type;
- typedef const _Ep& reference;
- typedef const _Ep& const_reference;
- typedef size_t size_type;
- typedef const _Ep* iterator;
- typedef const _Ep* const_iterator;
- _LIBCPP_ALWAYS_INLINE
- _LIBCPP_CONSTEXPR_AFTER_CXX11
- initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {}
- _LIBCPP_ALWAYS_INLINE
- _LIBCPP_CONSTEXPR_AFTER_CXX11
- size_t size() const _NOEXCEPT {return __size_;}
-
- _LIBCPP_ALWAYS_INLINE
- _LIBCPP_CONSTEXPR_AFTER_CXX11
- const _Ep* begin() const _NOEXCEPT {return __begin_;}
- _LIBCPP_ALWAYS_INLINE
- _LIBCPP_CONSTEXPR_AFTER_CXX11
- const _Ep* end() const _NOEXCEPT {return __begin_ + __size_;}
- };
- template<class _Ep>
- inline _LIBCPP_INLINE_VISIBILITY
- _LIBCPP_CONSTEXPR_AFTER_CXX11
- const _Ep*
- begin(initializer_list<_Ep> __il) _NOEXCEPT
- {
- return __il.begin();
- }
- template<class _Ep>
- inline _LIBCPP_INLINE_VISIBILITY
- _LIBCPP_CONSTEXPR_AFTER_CXX11
- const _Ep*
- end(initializer_list<_Ep> __il) _NOEXCEPT
- {
- return __il.end();
- }
- #endif
- }
- #endif
|