diff options
| author | Howard Hinnant <hhinnant@apple.com> | 2010-05-11 19:42:16 +0000 |
|---|---|---|
| committer | Howard Hinnant <hhinnant@apple.com> | 2010-05-11 19:42:16 +0000 |
| commit | 3e519524c118651123eecf60c2bbc5d65ad9bac3 (patch) | |
| tree | b2dd4168cfe448920a602cd7d2e40f95da187153 /libcxx/include/initializer_list | |
| parent | 9132c59d43b6c590c9bb33496eebf9f192d6857a (diff) | |
| download | bcm5719-llvm-3e519524c118651123eecf60c2bbc5d65ad9bac3.tar.gz bcm5719-llvm-3e519524c118651123eecf60c2bbc5d65ad9bac3.zip | |
libcxx initial import
llvm-svn: 103490
Diffstat (limited to 'libcxx/include/initializer_list')
| -rw-r--r-- | libcxx/include/initializer_list | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/libcxx/include/initializer_list b/libcxx/include/initializer_list new file mode 100644 index 00000000000..d780be90e7d --- /dev/null +++ b/libcxx/include/initializer_list @@ -0,0 +1,80 @@ +// -*- C++ -*- +//===----------------------- initializer_list -----------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP_INITIALIZER_LIST +#define _LIBCPP_INITIALIZER_LIST + +/* + initializer_list synopsis + +namespace std +{ + +template<class E> +class initializer_list +{ +public: + typedef E value_type; + typedef const E& reference; + typedef const E& const_reference; + typedef size_t size_type; + + typedef const E* iterator; + typedef const E* const_iterator; + + initializer_list(); + + size_t size() const; + const E* begin() const; + const E* end() const; +}; + +} // std + +*/ + +#include <__config> +#include <cstddef> + +#pragma GCC system_header + +namespace std // purposefully not versioned +{ + +template<class _E> +class initializer_list +{ + const _E* __begin_; + size_t __size_; + + _LIBCPP_ALWAYS_INLINE + initializer_list(const _E* __b, size_t __s) + : __begin_(__b), + __size_(__s) + {} +public: + typedef _E value_type; + typedef const _E& reference; + typedef const _E& const_reference; + typedef size_t size_type; + + typedef const _E* iterator; + typedef const _E* const_iterator; + + _LIBCPP_ALWAYS_INLINE initializer_list() : __begin_(nullptr), __size_(0) {} + + _LIBCPP_ALWAYS_INLINE size_t size() const {return __size_;} + _LIBCPP_ALWAYS_INLINE const _E* begin() const {return __begin_;} + _LIBCPP_ALWAYS_INLINE const _E* end() const {return __begin_ + __size_;} +}; + +} // std + +#endif // _LIBCPP_INITIALIZER_LIST |

