30 #ifndef _GLIBCXX_ARRAY
31 #define _GLIBCXX_ARRAY 1
33 #pragma GCC system_header
35 #ifndef __GXX_EXPERIMENTAL_CXX0X__
43 namespace std _GLIBCXX_VISIBILITY(default)
45 _GLIBCXX_BEGIN_NAMESPACE_VERSION
61 template<
typename _Tp, std::
size_t _Nm>
64 typedef _Tp value_type;
65 typedef value_type* pointer;
66 typedef const value_type* const_pointer;
67 typedef value_type& reference;
68 typedef const value_type& const_reference;
69 typedef value_type* iterator;
70 typedef const value_type* const_iterator;
71 typedef std::size_t size_type;
72 typedef std::ptrdiff_t difference_type;
77 value_type _M_instance[_Nm ? _Nm : 1];
83 fill(
const value_type& __u)
88 noexcept(noexcept(swap(std::declval<_Tp&>(), std::declval<_Tp&>())))
94 {
return iterator(data()); }
97 begin()
const noexcept
98 {
return const_iterator(data()); }
102 {
return iterator(data() + _Nm); }
106 {
return const_iterator(data() + _Nm); }
113 rbegin()
const noexcept
121 rend()
const noexcept
125 cbegin()
const noexcept
129 cend()
const noexcept
133 crbegin()
const noexcept
137 crend()
const noexcept
142 size()
const noexcept {
return _Nm; }
145 max_size()
const noexcept {
return _Nm; }
148 empty()
const noexcept {
return size() == 0; }
152 operator[](size_type __n)
153 {
return _M_instance[__n]; }
155 constexpr const_reference
156 operator[](size_type __n)
const noexcept
157 {
return _M_instance[__n]; }
163 std::__throw_out_of_range(__N(
"array::at"));
164 return _M_instance[__n];
167 constexpr const_reference
168 at(size_type __n)
const
172 return __n < _Nm ? _M_instance[__n]
173 : (std::__throw_out_of_range(__N(
"array::at")), _M_instance[0]);
186 {
return _Nm ? *(end() - 1) : *end(); }
190 {
return _Nm ? *(end() - 1) : *end(); }
197 data()
const noexcept
202 template<
typename _Tp, std::
size_t _Nm>
205 {
return std::equal(__one.begin(), __one.end(), __two.begin()); }
207 template<
typename _Tp, std::
size_t _Nm>
209 operator!=(
const array<_Tp, _Nm>& __one,
const array<_Tp, _Nm>& __two)
210 {
return !(__one == __two); }
212 template<
typename _Tp, std::
size_t _Nm>
214 operator<(const array<_Tp, _Nm>& __a,
const array<_Tp, _Nm>& __b)
217 __b.begin(), __b.end());
220 template<
typename _Tp, std::
size_t _Nm>
222 operator>(
const array<_Tp, _Nm>& __one,
const array<_Tp, _Nm>& __two)
223 {
return __two < __one; }
225 template<
typename _Tp, std::
size_t _Nm>
227 operator<=(const array<_Tp, _Nm>& __one,
const array<_Tp, _Nm>& __two)
228 {
return !(__one > __two); }
230 template<
typename _Tp, std::
size_t _Nm>
232 operator>=(
const array<_Tp, _Nm>& __one,
const array<_Tp, _Nm>& __two)
233 {
return !(__one < __two); }
236 template<
typename _Tp, std::
size_t _Nm>
238 swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two)
239 noexcept(noexcept(__one.swap(__two)))
240 { __one.swap(__two); }
245 template<
typename _Tp>
248 template<
typename _Tp, std::
size_t _Nm>
253 template<std::
size_t _Int,
typename _Tp>
256 template<std::
size_t _Int,
typename _Tp, std::
size_t _Nm>
258 {
typedef _Tp type; };
260 template<std::
size_t _Int,
typename _Tp, std::
size_t _Nm>
263 {
return __arr._M_instance[_Int]; }
265 template<std::
size_t _Int,
typename _Tp, std::
size_t _Nm>
267 get(array<_Tp, _Nm>&& __arr) noexcept
268 {
return std::move(get<_Int>(__arr)); }
270 template<std::
size_t _Int,
typename _Tp, std::
size_t _Nm>
272 get(
const array<_Tp, _Nm>& __arr) noexcept
273 {
return __arr._M_instance[_Int]; }
275 _GLIBCXX_END_NAMESPACE_VERSION
278 #endif // __GXX_EXPERIMENTAL_CXX0X__
280 #endif // _GLIBCXX_ARRAY
bool lexicographical_compare(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2, _Compare __comp)
Performs dictionary comparison on ranges.
A standard container for storing a fixed size sequence of elements.
_ForwardIterator2 swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2)
Swap the elements of two sequences.
_OI fill_n(_OI __first, _Size __n, const _Tp &__value)
Fills the range [first,first+n) with copies of value.
bool equal(_II1 __first1, _II1 __last1, _II2 __first2)
Tests a range for element-wise equality.
_Tp * __addressof(_Tp &__r) _GLIBCXX_NOEXCEPT
Same as C++11 std::addressof.