Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame^] | 1 | // -*- C++ -*- |
| 2 | //===----------------------- initializer_list -----------------------------===// |
| 3 | // |
| 4 | // ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure |
| 5 | // |
| 6 | // This file is distributed under the University of Illinois Open Source |
| 7 | // License. See LICENSE.TXT for details. |
| 8 | // |
| 9 | //===----------------------------------------------------------------------===// |
| 10 | |
| 11 | #ifndef _LIBCPP_INITIALIZER_LIST |
| 12 | #define _LIBCPP_INITIALIZER_LIST |
| 13 | |
| 14 | /* |
| 15 | initializer_list synopsis |
| 16 | |
| 17 | namespace std |
| 18 | { |
| 19 | |
| 20 | template<class E> |
| 21 | class initializer_list |
| 22 | { |
| 23 | public: |
| 24 | typedef E value_type; |
| 25 | typedef const E& reference; |
| 26 | typedef const E& const_reference; |
| 27 | typedef size_t size_type; |
| 28 | |
| 29 | typedef const E* iterator; |
| 30 | typedef const E* const_iterator; |
| 31 | |
| 32 | initializer_list(); |
| 33 | |
| 34 | size_t size() const; |
| 35 | const E* begin() const; |
| 36 | const E* end() const; |
| 37 | }; |
| 38 | |
| 39 | } // std |
| 40 | |
| 41 | */ |
| 42 | |
| 43 | #include <__config> |
| 44 | #include <cstddef> |
| 45 | |
| 46 | #pragma GCC system_header |
| 47 | |
| 48 | namespace std // purposefully not versioned |
| 49 | { |
| 50 | |
| 51 | template<class _E> |
| 52 | class initializer_list |
| 53 | { |
| 54 | const _E* __begin_; |
| 55 | size_t __size_; |
| 56 | |
| 57 | _LIBCPP_ALWAYS_INLINE |
| 58 | initializer_list(const _E* __b, size_t __s) |
| 59 | : __begin_(__b), |
| 60 | __size_(__s) |
| 61 | {} |
| 62 | public: |
| 63 | typedef _E value_type; |
| 64 | typedef const _E& reference; |
| 65 | typedef const _E& const_reference; |
| 66 | typedef size_t size_type; |
| 67 | |
| 68 | typedef const _E* iterator; |
| 69 | typedef const _E* const_iterator; |
| 70 | |
| 71 | _LIBCPP_ALWAYS_INLINE initializer_list() : __begin_(nullptr), __size_(0) {} |
| 72 | |
| 73 | _LIBCPP_ALWAYS_INLINE size_t size() const {return __size_;} |
| 74 | _LIBCPP_ALWAYS_INLINE const _E* begin() const {return __begin_;} |
| 75 | _LIBCPP_ALWAYS_INLINE const _E* end() const {return __begin_ + __size_;} |
| 76 | }; |
| 77 | |
| 78 | } // std |
| 79 | |
| 80 | #endif // _LIBCPP_INITIALIZER_LIST |