Usermode/libc++ - Implement map::insert and map::erase
[tpg/acess2.git] / Usermode / Libraries / libc++.so_src / include_exp / initializer_list
1 /*
2  * Acess2 C++ Library
3  * - By John Hodge (thePowersGang)
4  *
5  * vector (header)
6  * - C++'s vector (dynamic array) type
7  */
8 #ifndef _LIBCXX__INITIALIZER_LIST_
9 #define _LIBCXX__INITIALIZER_LIST_
10
11 namespace std {
12
13 template <class T>
14 class initializer_list
15 {
16 public:
17         typedef T       value_type;
18         typedef const T&        reference;
19         typedef const T&        const_reference;
20         typedef size_t  size_type;
21         typedef const T*        iterator;
22         typedef const T*        const_iterator;
23 private:
24         // ORDER MATTERS : The first item must be a pointer to the array, the second must be the size
25         value_type*     m_values;
26         size_type       m_len;
27 public: 
28         constexpr initializer_list() noexcept:
29                 m_len(0)
30         {
31         }
32
33         size_type size() const noexcept
34         {
35                 return m_len;
36         }
37         
38         const T* begin() const noexcept
39         {
40                 return &m_values[0];
41         }
42         const T* end() const noexcept
43         {
44                 return &m_values[m_len];
45         }
46 };
47
48 };
49
50 template <class T> const T* begin(const ::std::initializer_list<T>& il) { return il.begin(); }
51 template <class T> const T* end  (const ::std::initializer_list<T>& il) { return il.end(); }
52
53 #endif
54 // vim: ft=cpp
55

UCC git Repository :: git.ucc.asn.au