A standard container for storing a fixed size sequence of elements.
Sets support random access iterators.
40 _GLIBCXX_BEGIN_NAMESPACE_VERSION
56 template<
typename _Tp, std::
size_t _Nm>
59 typedef _Tp value_type;
60 typedef value_type& reference;
61 typedef const value_type& const_reference;
62 typedef value_type* iterator;
63 typedef const value_type* const_iterator;
66 typedef std::reverse_iterator<iterator> reverse_iterator;
67 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
70 value_type _M_instance[_Nm ? _Nm : 1];
75 assign(
const value_type& __u)
76 { std::fill_n(begin(), size(), __u); }
80 { std::swap_ranges(begin(), end(), __other.begin()); }
85 {
return iterator(std::__addressof(_M_instance[0])); }
89 {
return const_iterator(std::__addressof(_M_instance[0])); }
93 {
return iterator(std::__addressof(_M_instance[_Nm])); }
97 {
return const_iterator(std::__addressof(_M_instance[_Nm])); }
101 {
return reverse_iterator(end()); }
103 const_reverse_iterator
105 {
return const_reverse_iterator(end()); }
109 {
return reverse_iterator(begin()); }
111 const_reverse_iterator
113 {
return const_reverse_iterator(begin()); }
117 size()
const {
return _Nm; }
120 max_size()
const {
return _Nm; }
123 empty()
const {
return size() == 0; }
127 operator[](size_type __n)
128 {
return _M_instance[__n]; }
131 operator[](size_type __n)
const
132 {
return _M_instance[__n]; }
138 std::__throw_out_of_range(__N(
"array::at"));
139 return _M_instance[__n];
143 at(size_type __n)
const
146 std::__throw_out_of_range(__N(
"array::at"));
147 return _M_instance[__n];
160 {
return _Nm ? *(end() - 1) : *end(); }
164 {
return _Nm ? *(end() - 1) : *end(); }
168 {
return std::__addressof(_M_instance[0]); }
172 {
return std::__addressof(_M_instance[0]); }
176 template<
typename _Tp, std::
size_t _Nm>
178 operator==(
const array<_Tp, _Nm>& __one,
const array<_Tp, _Nm>& __two)
179 {
return std::equal(__one.begin(), __one.end(), __two.begin()); }
181 template<
typename _Tp, std::
size_t _Nm>
183 operator!=(
const array<_Tp, _Nm>& __one,
const array<_Tp, _Nm>& __two)
184 {
return !(__one == __two); }
186 template<
typename _Tp, std::
size_t _Nm>
188 operator<(const array<_Tp, _Nm>& __a,
const array<_Tp, _Nm>& __b)
190 return std::lexicographical_compare(__a.begin(), __a.end(),
191 __b.begin(), __b.end());
194 template<
typename _Tp, std::
size_t _Nm>
196 operator>(
const array<_Tp, _Nm>& __one,
const array<_Tp, _Nm>& __two)
197 {
return __two < __one; }
199 template<
typename _Tp, std::
size_t _Nm>
201 operator<=(const array<_Tp, _Nm>& __one,
const array<_Tp, _Nm>& __two)
202 {
return !(__one > __two); }
204 template<
typename _Tp, std::
size_t _Nm>
206 operator>=(
const array<_Tp, _Nm>& __one,
const array<_Tp, _Nm>& __two)
207 {
return !(__one < __two); }
210 template<
typename _Tp, std::
size_t _Nm>
212 swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two)
213 { __one.swap(__two); }
218 template<
typename _Tp>
222 template<
int _Int,
typename _Tp>
225 template<
typename _Tp, std::
size_t _Nm>
226 struct tuple_size<array<_Tp, _Nm> >
227 {
static const int value = _Nm; };
229 template<
typename _Tp, std::
size_t _Nm>
231 tuple_size<array<_Tp, _Nm> >::value;
233 template<
int _Int,
typename _Tp, std::
size_t _Nm>
234 struct tuple_element<_Int, array<_Tp, _Nm> >
235 {
typedef _Tp type; };
237 template<
int _Int,
typename _Tp, std::
size_t _Nm>
239 get(array<_Tp, _Nm>& __arr)
240 {
return __arr[_Int]; }
242 template<
int _Int,
typename _Tp, std::
size_t _Nm>
244 get(
const array<_Tp, _Nm>& __arr)
245 {
return __arr[_Int]; }
247 _GLIBCXX_END_NAMESPACE_VERSION
bool operator>=(const _Safe_iterator< _IteratorL, _Sequence > &__lhs, const _Safe_iterator< _IteratorR, _Sequence > &__rhs)
Definition: safe_iterator.h:644
bool operator==(const exception_ptr &, const exception_ptr &) _GLIBCXX_USE_NOEXCEPT __attribute__((__pure__))
bool operator>(const _Safe_iterator< _IteratorL, _Sequence > &__lhs, const _Safe_iterator< _IteratorR, _Sequence > &__rhs)
Definition: safe_iterator.h:612
bool operator!=(const exception_ptr &, const exception_ptr &) _GLIBCXX_USE_NOEXCEPT __attribute__((__pure__))
__SIZE_TYPE__ size_t
Definition: stddef.h:212
__PTRDIFF_TYPE__ ptrdiff_t
Definition: stddef.h:147
void swap(exception_ptr &__lhs, exception_ptr &__rhs)
Definition: exception_ptr.h:160