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