21 #ifndef __utl_container_array_h__ 22 #define __utl_container_array_h__ 34 template<
typename _Tp,
size_t _Nm>
39 static constexpr _Tp&
Ref (
const type& t,
size_t n) noexcept {
40 return const_cast<_Tp&
>(t[n]);
43 static constexpr _Tp*
Ptr(
const type& t) noexcept {
44 return const_cast<_Tp*
>(t);
48 template<
typename _Tp>
52 static constexpr _Tp&
Ref(
const type&,
size_t) noexcept {
53 return *
static_cast<_Tp*
>(
nullptr);
56 static constexpr _Tp*
Ptr(
const type&) noexcept {
76 template <
typename _Tp,
size_t _Nm>
89 = std::reverse_iterator <const_iterator>;
102 std::swap_ranges (
begin(),
end(), other.begin());
125 constexpr
bool empty() const noexcept {
return size() == 0; }
152 static_assert ((n < _Nm),
"array::at: out of range");
165 return _Nm ? *(
end() - 1) : *
end();
180 template<
typename _Tp,
size_t _Nm>
185 template<
typename _Tp,
size_t _Nm>
187 return !(lhs == rhs);
190 template<
typename _Tp,
size_t _Nm>
192 return std::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
195 template<
typename _Tp,
size_t _Nm>
200 template<
typename _Tp,
size_t _Nm>
205 template<
typename _Tp,
size_t _Nm>
213 template<
typename _Tp,
size_t _Nm>
215 noexcept (noexcept (lhs.swap(rhs))) {
219 template<
size_t _Int,
typename _Tp,
size_t _Nm>
221 static_assert(_Int < _Nm,
"Index is out of bounds");
225 template<
size_t _Int,
typename _Tp,
size_t _Nm>
227 static_assert(_Int < _Nm,
"Index is out of bounds");
228 return std::move(std::get<_Int>(arr));
231 template<
size_t _Int,
typename _Tp,
size_t _Nm>
233 static_assert(_Int < _Nm,
"Index is out of bounds");
const_iterator cend() const noexcept
bool operator==(const array< _Tp, _Nm > &lhs, const array< _Tp, _Nm > &rhs)
reference front() noexcept
ptrdiff_t difference_type
A standard container for storing a fixed size sequence of elements.
constexpr const_reference operator[](size_type n) const noexcept
Operator [] for const.
reverse_iterator rend() noexcept
static constexpr _Tp & Ref(const type &, size_t) noexcept
const_iterator end() const noexcept
const_pointer data() const noexcept
constexpr bool empty() const noexcept
void swap(array &other) noexcept
const_reverse_iterator rbegin() const noexcept
reference back() noexcept
const_reverse_iterator crbegin() const noexcept
const_reverse_iterator rend() const noexcept
const value_type * const_iterator
array container traits helper
std::reverse_iterator< const_iterator > const_reverse_iterator
const value_type * const_pointer
bool operator>=(const array< _Tp, _Nm > &lhs, const array< _Tp, _Nm > &rhs)
std::reverse_iterator< iterator > reverse_iterator
static constexpr _Tp * Ptr(const type &) noexcept
constexpr const_reference back() const noexcept
STL's core language concepts.
reference at(size_type n) noexcept
reference operator[](size_type n) noexcept
Operator [].
void fill(const value_type &v)
bool operator>(const array< _Tp, _Nm > &lhs, const array< _Tp, _Nm > &rhs)
constexpr const_reference at(size_type n) const noexcept
Compile time boundary check dereference operator.
reverse_iterator rbegin() noexcept
static constexpr _Tp * Ptr(const type &t) noexcept
constexpr size_type size() const noexcept
const_reverse_iterator crend() const noexcept
iterator begin() noexcept
bool operator!=(const array< _Tp, _Nm > &lhs, const array< _Tp, _Nm > &rhs)
constexpr const_reference front() const noexcept
const_iterator cbegin() const noexcept
constexpr size_type max_size() const noexcept
const_iterator begin() const noexcept
void swap(array< _Tp, _Nm > &lhs, array< _Tp, _Nm > &rhs) noexcept(noexcept(lhs.swap(rhs)))
const value_type & const_reference
Implementation detail main forward header.
static constexpr _Tp & Ref(const type &t, size_t n) noexcept