1*4684ddb6SLionel Sambuc// -*- C++ -*- 2*4684ddb6SLionel Sambuc//===----------------------- initializer_list -----------------------------===// 3*4684ddb6SLionel Sambuc// 4*4684ddb6SLionel Sambuc// The LLVM Compiler Infrastructure 5*4684ddb6SLionel Sambuc// 6*4684ddb6SLionel Sambuc// This file is dual licensed under the MIT and the University of Illinois Open 7*4684ddb6SLionel Sambuc// Source Licenses. See LICENSE.TXT for details. 8*4684ddb6SLionel Sambuc// 9*4684ddb6SLionel Sambuc//===----------------------------------------------------------------------===// 10*4684ddb6SLionel Sambuc 11*4684ddb6SLionel Sambuc#ifndef _LIBCPP_INITIALIZER_LIST 12*4684ddb6SLionel Sambuc#define _LIBCPP_INITIALIZER_LIST 13*4684ddb6SLionel Sambuc 14*4684ddb6SLionel Sambuc/* 15*4684ddb6SLionel Sambuc initializer_list synopsis 16*4684ddb6SLionel Sambuc 17*4684ddb6SLionel Sambucnamespace std 18*4684ddb6SLionel Sambuc{ 19*4684ddb6SLionel Sambuc 20*4684ddb6SLionel Sambuctemplate<class E> 21*4684ddb6SLionel Sambucclass initializer_list 22*4684ddb6SLionel Sambuc{ 23*4684ddb6SLionel Sambucpublic: 24*4684ddb6SLionel Sambuc typedef E value_type; 25*4684ddb6SLionel Sambuc typedef const E& reference; 26*4684ddb6SLionel Sambuc typedef const E& const_reference; 27*4684ddb6SLionel Sambuc typedef size_t size_type; 28*4684ddb6SLionel Sambuc 29*4684ddb6SLionel Sambuc typedef const E* iterator; 30*4684ddb6SLionel Sambuc typedef const E* const_iterator; 31*4684ddb6SLionel Sambuc 32*4684ddb6SLionel Sambuc initializer_list() noexcept; // constexpr in C++14 33*4684ddb6SLionel Sambuc 34*4684ddb6SLionel Sambuc size_t size() const noexcept; // constexpr in C++14 35*4684ddb6SLionel Sambuc const E* begin() const noexcept; // constexpr in C++14 36*4684ddb6SLionel Sambuc const E* end() const noexcept; // constexpr in C++14 37*4684ddb6SLionel Sambuc}; 38*4684ddb6SLionel Sambuc 39*4684ddb6SLionel Sambuctemplate<class E> const E* begin(initializer_list<E> il) noexcept; // constexpr in C++14 40*4684ddb6SLionel Sambuctemplate<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in C++14 41*4684ddb6SLionel Sambuc 42*4684ddb6SLionel Sambuc} // std 43*4684ddb6SLionel Sambuc 44*4684ddb6SLionel Sambuc*/ 45*4684ddb6SLionel Sambuc 46*4684ddb6SLionel Sambuc#include <__config> 47*4684ddb6SLionel Sambuc#include <cstddef> 48*4684ddb6SLionel Sambuc 49*4684ddb6SLionel Sambuc#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 50*4684ddb6SLionel Sambuc#pragma GCC system_header 51*4684ddb6SLionel Sambuc#endif 52*4684ddb6SLionel Sambuc 53*4684ddb6SLionel Sambucnamespace std // purposefully not versioned 54*4684ddb6SLionel Sambuc{ 55*4684ddb6SLionel Sambuc 56*4684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 57*4684ddb6SLionel Sambuc 58*4684ddb6SLionel Sambuctemplate<class _Ep> 59*4684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY initializer_list 60*4684ddb6SLionel Sambuc{ 61*4684ddb6SLionel Sambuc const _Ep* __begin_; 62*4684ddb6SLionel Sambuc size_t __size_; 63*4684ddb6SLionel Sambuc 64*4684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 65*4684ddb6SLionel Sambuc _LIBCPP_CONSTEXPR_AFTER_CXX11 66*4684ddb6SLionel Sambuc initializer_list(const _Ep* __b, size_t __s) _NOEXCEPT 67*4684ddb6SLionel Sambuc : __begin_(__b), 68*4684ddb6SLionel Sambuc __size_(__s) 69*4684ddb6SLionel Sambuc {} 70*4684ddb6SLionel Sambucpublic: 71*4684ddb6SLionel Sambuc typedef _Ep value_type; 72*4684ddb6SLionel Sambuc typedef const _Ep& reference; 73*4684ddb6SLionel Sambuc typedef const _Ep& const_reference; 74*4684ddb6SLionel Sambuc typedef size_t size_type; 75*4684ddb6SLionel Sambuc 76*4684ddb6SLionel Sambuc typedef const _Ep* iterator; 77*4684ddb6SLionel Sambuc typedef const _Ep* const_iterator; 78*4684ddb6SLionel Sambuc 79*4684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 80*4684ddb6SLionel Sambuc _LIBCPP_CONSTEXPR_AFTER_CXX11 81*4684ddb6SLionel Sambuc initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {} 82*4684ddb6SLionel Sambuc 83*4684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 84*4684ddb6SLionel Sambuc _LIBCPP_CONSTEXPR_AFTER_CXX11 85*4684ddb6SLionel Sambuc size_t size() const _NOEXCEPT {return __size_;} 86*4684ddb6SLionel Sambuc 87*4684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 88*4684ddb6SLionel Sambuc _LIBCPP_CONSTEXPR_AFTER_CXX11 89*4684ddb6SLionel Sambuc const _Ep* begin() const _NOEXCEPT {return __begin_;} 90*4684ddb6SLionel Sambuc 91*4684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 92*4684ddb6SLionel Sambuc _LIBCPP_CONSTEXPR_AFTER_CXX11 93*4684ddb6SLionel Sambuc const _Ep* end() const _NOEXCEPT {return __begin_ + __size_;} 94*4684ddb6SLionel Sambuc}; 95*4684ddb6SLionel Sambuc 96*4684ddb6SLionel Sambuctemplate<class _Ep> 97*4684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 98*4684ddb6SLionel Sambuc_LIBCPP_CONSTEXPR_AFTER_CXX11 99*4684ddb6SLionel Sambucconst _Ep* 100*4684ddb6SLionel Sambucbegin(initializer_list<_Ep> __il) _NOEXCEPT 101*4684ddb6SLionel Sambuc{ 102*4684ddb6SLionel Sambuc return __il.begin(); 103*4684ddb6SLionel Sambuc} 104*4684ddb6SLionel Sambuc 105*4684ddb6SLionel Sambuctemplate<class _Ep> 106*4684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 107*4684ddb6SLionel Sambuc_LIBCPP_CONSTEXPR_AFTER_CXX11 108*4684ddb6SLionel Sambucconst _Ep* 109*4684ddb6SLionel Sambucend(initializer_list<_Ep> __il) _NOEXCEPT 110*4684ddb6SLionel Sambuc{ 111*4684ddb6SLionel Sambuc return __il.end(); 112*4684ddb6SLionel Sambuc} 113*4684ddb6SLionel Sambuc 114*4684ddb6SLionel Sambuc#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 115*4684ddb6SLionel Sambuc 116*4684ddb6SLionel Sambuc} // std 117*4684ddb6SLionel Sambuc 118*4684ddb6SLionel Sambuc#endif // _LIBCPP_INITIALIZER_LIST 119