1227825Stheraven// -*- C++ -*- 2227825Stheraven//===----------------------- initializer_list -----------------------------===// 3227825Stheraven// 4227825Stheraven// The LLVM Compiler Infrastructure 5227825Stheraven// 6227825Stheraven// This file is dual licensed under the MIT and the University of Illinois Open 7227825Stheraven// Source Licenses. See LICENSE.TXT for details. 8227825Stheraven// 9227825Stheraven//===----------------------------------------------------------------------===// 10227825Stheraven 11227825Stheraven#ifndef _LIBCPP_INITIALIZER_LIST 12227825Stheraven#define _LIBCPP_INITIALIZER_LIST 13227825Stheraven 14227825Stheraven/* 15227825Stheraven initializer_list synopsis 16227825Stheraven 17227825Stheravennamespace std 18227825Stheraven{ 19227825Stheraven 20227825Stheraventemplate<class E> 21227825Stheravenclass initializer_list 22227825Stheraven{ 23227825Stheravenpublic: 24227825Stheraven typedef E value_type; 25227825Stheraven typedef const E& reference; 26227825Stheraven typedef const E& const_reference; 27227825Stheraven typedef size_t size_type; 28227825Stheraven 29227825Stheraven typedef const E* iterator; 30227825Stheraven typedef const E* const_iterator; 31227825Stheraven 32261272Sdim initializer_list() noexcept; // constexpr in C++14 33227825Stheraven 34261272Sdim size_t size() const noexcept; // constexpr in C++14 35261272Sdim const E* begin() const noexcept; // constexpr in C++14 36261272Sdim const E* end() const noexcept; // constexpr in C++14 37227825Stheraven}; 38227825Stheraven 39261272Sdimtemplate<class E> const E* begin(initializer_list<E> il) noexcept; // constexpr in C++14 40261272Sdimtemplate<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in C++14 41227825Stheraven 42227825Stheraven} // std 43227825Stheraven 44227825Stheraven*/ 45227825Stheraven 46227825Stheraven#include <__config> 47227825Stheraven#include <cstddef> 48227825Stheraven 49227825Stheraven#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 50227825Stheraven#pragma GCC system_header 51227825Stheraven#endif 52227825Stheraven 53227825Stheravennamespace std // purposefully not versioned 54227825Stheraven{ 55227825Stheraven 56227825Stheraven#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 57227825Stheraven 58232924Stheraventemplate<class _Ep> 59261272Sdimclass _LIBCPP_TYPE_VIS_ONLY initializer_list 60227825Stheraven{ 61232924Stheraven const _Ep* __begin_; 62227825Stheraven size_t __size_; 63227825Stheraven 64227825Stheraven _LIBCPP_ALWAYS_INLINE 65261272Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 66232924Stheraven initializer_list(const _Ep* __b, size_t __s) _NOEXCEPT 67227825Stheraven : __begin_(__b), 68227825Stheraven __size_(__s) 69227825Stheraven {} 70227825Stheravenpublic: 71232924Stheraven typedef _Ep value_type; 72232924Stheraven typedef const _Ep& reference; 73232924Stheraven typedef const _Ep& const_reference; 74227825Stheraven typedef size_t size_type; 75227825Stheraven 76232924Stheraven typedef const _Ep* iterator; 77232924Stheraven typedef const _Ep* const_iterator; 78227825Stheraven 79261272Sdim _LIBCPP_ALWAYS_INLINE 80261272Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 81261272Sdim initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {} 82227825Stheraven 83261272Sdim _LIBCPP_ALWAYS_INLINE 84261272Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 85261272Sdim size_t size() const _NOEXCEPT {return __size_;} 86261272Sdim 87261272Sdim _LIBCPP_ALWAYS_INLINE 88261272Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 89261272Sdim const _Ep* begin() const _NOEXCEPT {return __begin_;} 90261272Sdim 91261272Sdim _LIBCPP_ALWAYS_INLINE 92261272Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 93261272Sdim const _Ep* end() const _NOEXCEPT {return __begin_ + __size_;} 94227825Stheraven}; 95227825Stheraven 96232924Stheraventemplate<class _Ep> 97227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 98261272Sdim_LIBCPP_CONSTEXPR_AFTER_CXX11 99232924Stheravenconst _Ep* 100232924Stheravenbegin(initializer_list<_Ep> __il) _NOEXCEPT 101227825Stheraven{ 102227825Stheraven return __il.begin(); 103227825Stheraven} 104227825Stheraven 105232924Stheraventemplate<class _Ep> 106227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 107261272Sdim_LIBCPP_CONSTEXPR_AFTER_CXX11 108232924Stheravenconst _Ep* 109232924Stheravenend(initializer_list<_Ep> __il) _NOEXCEPT 110227825Stheraven{ 111227825Stheraven return __il.end(); 112227825Stheraven} 113227825Stheraven 114227825Stheraven#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 115227825Stheraven 116227825Stheraven} // std 117227825Stheraven 118227825Stheraven#endif // _LIBCPP_INITIALIZER_LIST 119