Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/c++/v1/__cxx03/initializer_list is written in an unsupported language. File is not indexed.

0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef _LIBCPP___CXX03_INITIALIZER_LIST
0011 #define _LIBCPP___CXX03_INITIALIZER_LIST
0012 
0013 /*
0014     initializer_list synopsis
0015 
0016 namespace std
0017 {
0018 
0019 template<class E>
0020 class initializer_list
0021 {
0022 public:
0023     typedef E        value_type;
0024     typedef const E& reference;
0025     typedef const E& const_reference;
0026     typedef size_t   size_type;
0027 
0028     typedef const E* iterator;
0029     typedef const E* const_iterator;
0030 
0031     initializer_list() noexcept; // constexpr in C++14
0032 
0033     size_t   size()  const noexcept; // constexpr in C++14
0034     const E* begin() const noexcept; // constexpr in C++14
0035     const E* end()   const noexcept; // constexpr in C++14
0036 };
0037 
0038 template<class E> const E* begin(initializer_list<E> il) noexcept; // constexpr in C++14
0039 template<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in C++14
0040 
0041 }  // std
0042 
0043 */
0044 
0045 #include <__cxx03/__config>
0046 #include <__cxx03/cstddef>
0047 
0048 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0049 #  pragma GCC system_header
0050 #endif
0051 
0052 namespace std // purposefully not versioned
0053 {
0054 
0055 #ifndef _LIBCPP_CXX03_LANG
0056 
0057 template <class _Ep>
0058 class _LIBCPP_TEMPLATE_VIS initializer_list {
0059   const _Ep* __begin_;
0060   size_t __size_;
0061 
0062   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 initializer_list(const _Ep* __b, size_t __s) _NOEXCEPT
0063       : __begin_(__b),
0064         __size_(__s) {}
0065 
0066 public:
0067   typedef _Ep value_type;
0068   typedef const _Ep& reference;
0069   typedef const _Ep& const_reference;
0070   typedef size_t size_type;
0071 
0072   typedef const _Ep* iterator;
0073   typedef const _Ep* const_iterator;
0074 
0075   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {}
0076 
0077   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 size_t size() const _NOEXCEPT { return __size_; }
0078 
0079   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* begin() const _NOEXCEPT { return __begin_; }
0080 
0081   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* end() const _NOEXCEPT { return __begin_ + __size_; }
0082 };
0083 
0084 template <class _Ep>
0085 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* begin(initializer_list<_Ep> __il) _NOEXCEPT {
0086   return __il.begin();
0087 }
0088 
0089 template <class _Ep>
0090 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* end(initializer_list<_Ep> __il) _NOEXCEPT {
0091   return __il.end();
0092 }
0093 
0094 #endif // !defined(_LIBCPP_CXX03_LANG)
0095 
0096 } // namespace std
0097 
0098 #endif // _LIBCPP___CXX03_INITIALIZER_LIST