17a984708SDavid Chisnall// -*- C++ -*- 27a984708SDavid Chisnall//===----------------------- initializer_list -----------------------------===// 37a984708SDavid Chisnall// 47a984708SDavid Chisnall// The LLVM Compiler Infrastructure 57a984708SDavid Chisnall// 67a984708SDavid Chisnall// This file is dual licensed under the MIT and the University of Illinois Open 77a984708SDavid Chisnall// Source Licenses. See LICENSE.TXT for details. 87a984708SDavid Chisnall// 97a984708SDavid Chisnall//===----------------------------------------------------------------------===// 107a984708SDavid Chisnall 117a984708SDavid Chisnall#ifndef _LIBCPP_INITIALIZER_LIST 127a984708SDavid Chisnall#define _LIBCPP_INITIALIZER_LIST 137a984708SDavid Chisnall 147a984708SDavid Chisnall/* 157a984708SDavid Chisnall initializer_list synopsis 167a984708SDavid Chisnall 177a984708SDavid Chisnallnamespace std 187a984708SDavid Chisnall{ 197a984708SDavid Chisnall 207a984708SDavid Chisnalltemplate<class E> 217a984708SDavid Chisnallclass initializer_list 227a984708SDavid Chisnall{ 237a984708SDavid Chisnallpublic: 247a984708SDavid Chisnall typedef E value_type; 257a984708SDavid Chisnall typedef const E& reference; 267a984708SDavid Chisnall typedef const E& const_reference; 277a984708SDavid Chisnall typedef size_t size_type; 287a984708SDavid Chisnall 297a984708SDavid Chisnall typedef const E* iterator; 307a984708SDavid Chisnall typedef const E* const_iterator; 317a984708SDavid Chisnall 324f7ab58eSDimitry Andric initializer_list() noexcept; // constexpr in C++14 337a984708SDavid Chisnall 344f7ab58eSDimitry Andric size_t size() const noexcept; // constexpr in C++14 354f7ab58eSDimitry Andric const E* begin() const noexcept; // constexpr in C++14 364f7ab58eSDimitry Andric const E* end() const noexcept; // constexpr in C++14 377a984708SDavid Chisnall}; 387a984708SDavid Chisnall 394f7ab58eSDimitry Andrictemplate<class E> const E* begin(initializer_list<E> il) noexcept; // constexpr in C++14 404f7ab58eSDimitry Andrictemplate<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in C++14 417a984708SDavid Chisnall 427a984708SDavid Chisnall} // std 437a984708SDavid Chisnall 447a984708SDavid Chisnall*/ 457a984708SDavid Chisnall 467a984708SDavid Chisnall#include <__config> 477a984708SDavid Chisnall#include <cstddef> 487a984708SDavid Chisnall 497a984708SDavid Chisnall#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 507a984708SDavid Chisnall#pragma GCC system_header 517a984708SDavid Chisnall#endif 527a984708SDavid Chisnall 537a984708SDavid Chisnallnamespace std // purposefully not versioned 547a984708SDavid Chisnall{ 557a984708SDavid Chisnall 56540d2a8bSDimitry Andric#ifndef _LIBCPP_CXX03_LANG 577a984708SDavid Chisnall 5894e3ee44SDavid Chisnalltemplate<class _Ep> 59aed8d94eSDimitry Andricclass _LIBCPP_TEMPLATE_VIS initializer_list 607a984708SDavid Chisnall{ 6194e3ee44SDavid Chisnall const _Ep* __begin_; 627a984708SDavid Chisnall size_t __size_; 637a984708SDavid Chisnall 64*4ba319b5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 654f7ab58eSDimitry Andric _LIBCPP_CONSTEXPR_AFTER_CXX11 6694e3ee44SDavid Chisnall initializer_list(const _Ep* __b, size_t __s) _NOEXCEPT 677a984708SDavid Chisnall : __begin_(__b), 687a984708SDavid Chisnall __size_(__s) 697a984708SDavid Chisnall {} 707a984708SDavid Chisnallpublic: 7194e3ee44SDavid Chisnall typedef _Ep value_type; 7294e3ee44SDavid Chisnall typedef const _Ep& reference; 7394e3ee44SDavid Chisnall typedef const _Ep& const_reference; 747a984708SDavid Chisnall typedef size_t size_type; 757a984708SDavid Chisnall 7694e3ee44SDavid Chisnall typedef const _Ep* iterator; 7794e3ee44SDavid Chisnall typedef const _Ep* const_iterator; 787a984708SDavid Chisnall 79*4ba319b5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 804f7ab58eSDimitry Andric _LIBCPP_CONSTEXPR_AFTER_CXX11 814f7ab58eSDimitry Andric initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {} 827a984708SDavid Chisnall 83*4ba319b5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 844f7ab58eSDimitry Andric _LIBCPP_CONSTEXPR_AFTER_CXX11 854f7ab58eSDimitry Andric size_t size() const _NOEXCEPT {return __size_;} 864f7ab58eSDimitry Andric 87*4ba319b5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 884f7ab58eSDimitry Andric _LIBCPP_CONSTEXPR_AFTER_CXX11 894f7ab58eSDimitry Andric const _Ep* begin() const _NOEXCEPT {return __begin_;} 904f7ab58eSDimitry Andric 91*4ba319b5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 924f7ab58eSDimitry Andric _LIBCPP_CONSTEXPR_AFTER_CXX11 934f7ab58eSDimitry Andric const _Ep* end() const _NOEXCEPT {return __begin_ + __size_;} 947a984708SDavid Chisnall}; 957a984708SDavid Chisnall 9694e3ee44SDavid Chisnalltemplate<class _Ep> 977a984708SDavid Chisnallinline _LIBCPP_INLINE_VISIBILITY 984f7ab58eSDimitry Andric_LIBCPP_CONSTEXPR_AFTER_CXX11 9994e3ee44SDavid Chisnallconst _Ep* 10094e3ee44SDavid Chisnallbegin(initializer_list<_Ep> __il) _NOEXCEPT 1017a984708SDavid Chisnall{ 1027a984708SDavid Chisnall return __il.begin(); 1037a984708SDavid Chisnall} 1047a984708SDavid Chisnall 10594e3ee44SDavid Chisnalltemplate<class _Ep> 1067a984708SDavid Chisnallinline _LIBCPP_INLINE_VISIBILITY 1074f7ab58eSDimitry Andric_LIBCPP_CONSTEXPR_AFTER_CXX11 10894e3ee44SDavid Chisnallconst _Ep* 10994e3ee44SDavid Chisnallend(initializer_list<_Ep> __il) _NOEXCEPT 1107a984708SDavid Chisnall{ 1117a984708SDavid Chisnall return __il.end(); 1127a984708SDavid Chisnall} 1137a984708SDavid Chisnall 114540d2a8bSDimitry Andric#endif // !defined(_LIBCPP_CXX03_LANG) 1157a984708SDavid Chisnall 1167a984708SDavid Chisnall} // std 1177a984708SDavid Chisnall 1187a984708SDavid Chisnall#endif // _LIBCPP_INITIALIZER_LIST 119