mn_initializer_list.hpp
Go to the documentation of this file.
1 
21 #ifndef __MINILIB_INITIALIZER_LIST_H__
22 #define __MINILIB_INITIALIZER_LIST_H__
23 
24 namespace mn {
25  template <typename T>
27  public:
28  using value_type = T;
29  using reference = T&;
30  using const_reference = const T&;
31  using pointer = T*;
32  using const_pointer = const T*;
34  using iterator = T*;
35  using const_iterator = const T*;
36 
40  constexpr basic_initializer_list() noexcept
41  : m_pArray(0), m_szSize(0) { }
42 
47  constexpr size_type size() const noexcept { return m_szSize; }
48 
53  constexpr const_iterator begin() const noexcept { return m_pArray; }
54 
59  constexpr const_iterator end() const noexcept { return begin() + size(); }
60 
66  template<class U>
67  constexpr const U* begin(basic_initializer_list<U> pOther) noexcept {
68  return pOther.begin();
69  }
70 
76  template<class U>
77  constexpr const U* end(basic_initializer_list<U> pOther) noexcept {
78  return pOther.end();
79  }
80  private:
87  : m_pArray(a), m_szSize(l) { }
88  private:
91  };
92 
93  template <typename T>
95 }
96 
97 #endif // __MINILIB_INITIALIZER_LIST_H__
Definition: mn_initializer_list.hpp:26
constexpr basic_initializer_list() noexcept
The default construtor.
Definition: mn_initializer_list.hpp:40
const T & const_reference
Definition: mn_initializer_list.hpp:30
pointer m_pArray
Definition: mn_initializer_list.hpp:89
T value_type
Definition: mn_initializer_list.hpp:28
T * iterator
Definition: mn_initializer_list.hpp:34
constexpr const_iterator begin() const noexcept
Get a pointer from the first element of the list.
Definition: mn_initializer_list.hpp:53
constexpr basic_initializer_list(const_pointer a, size_type l)
A private constructor.
Definition: mn_initializer_list.hpp:86
const T * const_iterator
Definition: mn_initializer_list.hpp:35
mn::size_t size_type
Definition: mn_initializer_list.hpp:33
T * pointer
Definition: mn_initializer_list.hpp:31
constexpr size_type size() const noexcept
Get the number of elements in the list.
Definition: mn_initializer_list.hpp:47
size_type m_szSize
Definition: mn_initializer_list.hpp:90
const T * const_pointer
Definition: mn_initializer_list.hpp:32
constexpr const_iterator end() const noexcept
Get a pointer from the last element of the list.
Definition: mn_initializer_list.hpp:59
constexpr const U * end(basic_initializer_list< U > pOther) noexcept
Get a pointer from the last element of the list.
Definition: mn_initializer_list.hpp:77
T & reference
Definition: mn_initializer_list.hpp:29
constexpr const U * begin(basic_initializer_list< U > pOther) noexcept
Get a pointer from the first element of the list.
Definition: mn_initializer_list.hpp:67
struct mn::memory::detail::ptr_difference T
Definition: mn_atomic_singleton.hpp:38
Definition: mn_allocator_typetraits.hpp:25
MN_THREAD_CONFIG_SIZE_TYPE size_t
Definition: mn_def.hpp:48