2010-05-11 21:42:16 +02:00
|
|
|
// -*- C++ -*-
|
|
|
|
//===----------------------- initializer_list -----------------------------===//
|
|
|
|
//
|
2010-05-11 23:36:01 +02:00
|
|
|
// The LLVM Compiler Infrastructure
|
2010-05-11 21:42:16 +02:00
|
|
|
//
|
2010-11-16 23:09:02 +01:00
|
|
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
|
|
// Source Licenses. See LICENSE.TXT for details.
|
2010-05-11 21:42:16 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#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;
|
|
|
|
};
|
|
|
|
|
2010-05-28 19:53:59 +02:00
|
|
|
template<class E> const E* begin(initializer_list<E> il);
|
|
|
|
template<class E> const E* end(initializer_list<E> il);
|
|
|
|
|
2010-05-11 21:42:16 +02:00
|
|
|
} // std
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <__config>
|
|
|
|
#include <cstddef>
|
|
|
|
|
|
|
|
#pragma GCC system_header
|
|
|
|
|
|
|
|
namespace std // purposefully not versioned
|
|
|
|
{
|
|
|
|
|
|
|
|
template<class _E>
|
2010-09-22 17:29:08 +02:00
|
|
|
class _LIBCPP_VISIBLE initializer_list
|
2010-05-11 21:42:16 +02:00
|
|
|
{
|
|
|
|
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_;}
|
|
|
|
};
|
|
|
|
|
2010-05-28 19:53:59 +02:00
|
|
|
template<class _E>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
const _E*
|
|
|
|
begin(initializer_list<_E> __il)
|
|
|
|
{
|
|
|
|
return __il.begin();
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class _E>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
const _E*
|
|
|
|
end(initializer_list<_E> __il)
|
|
|
|
{
|
|
|
|
return __il.end();
|
|
|
|
}
|
|
|
|
|
2010-05-11 21:42:16 +02:00
|
|
|
} // std
|
|
|
|
|
|
|
|
#endif // _LIBCPP_INITIALIZER_LIST
|