30 #ifndef _GLIBCXX_RANGE_ACCESS_H
31 #define _GLIBCXX_RANGE_ACCESS_H 1
33 #pragma GCC system_header
35 #if __cplusplus >= 201103L
36 #include <initializer_list>
37 namespace std _GLIBCXX_VISIBILITY(default)
39 _GLIBCXX_BEGIN_NAMESPACE_VERSION
46 template<
class _Container>
48 begin(_Container& __cont) -> decltype(__cont.begin())
49 {
return __cont.begin(); }
56 template<
class _Container>
58 begin(
const _Container& __cont) -> decltype(__cont.begin())
59 {
return __cont.begin(); }
66 template<
class _Container>
68 end(_Container& __cont) -> decltype(__cont.end())
69 {
return __cont.end(); }
76 template<
class _Container>
78 end(
const _Container& __cont) -> decltype(__cont.end())
79 {
return __cont.end(); }
85 template<
class _Tp,
size_t _Nm>
86 inline _GLIBCXX14_CONSTEXPR _Tp*
95 template<
class _Tp,
size_t _Nm>
96 inline _GLIBCXX14_CONSTEXPR _Tp*
97 end(_Tp (&__arr)[_Nm])
98 {
return __arr + _Nm; }
100 #if __cplusplus >= 201402L
106 template<
class _Container>
107 inline constexpr
auto
108 cbegin(
const _Container& __cont) noexcept(noexcept(
std::begin(__cont)))
117 template<
class _Container>
118 inline constexpr
auto
119 cend(
const _Container& __cont) noexcept(noexcept(
std::end(__cont)))
128 template<
class _Container>
130 rbegin(_Container& __cont) -> decltype(__cont.rbegin())
131 {
return __cont.rbegin(); }
138 template<
class _Container>
140 rbegin(
const _Container& __cont) -> decltype(__cont.rbegin())
141 {
return __cont.rbegin(); }
148 template<
class _Container>
150 rend(_Container& __cont) -> decltype(__cont.rend())
151 {
return __cont.rend(); }
158 template<
class _Container>
160 rend(
const _Container& __cont) -> decltype(__cont.rend())
161 {
return __cont.rend(); }
168 template<
class _Tp,
size_t _Nm>
169 inline reverse_iterator<_Tp*>
170 rbegin(_Tp (&__arr)[_Nm])
171 {
return reverse_iterator<_Tp*>(__arr + _Nm); }
178 template<
class _Tp,
size_t _Nm>
179 inline reverse_iterator<_Tp*>
180 rend(_Tp (&__arr)[_Nm])
181 {
return reverse_iterator<_Tp*>(__arr); }
189 inline reverse_iterator<const _Tp*>
190 rbegin(initializer_list<_Tp> __il)
191 {
return reverse_iterator<const _Tp*>(__il.end()); }
199 inline reverse_iterator<const _Tp*>
200 rend(initializer_list<_Tp> __il)
201 {
return reverse_iterator<const _Tp*>(__il.begin()); }
208 template<
class _Container>
210 crbegin(
const _Container& __cont) -> decltype(std::rbegin(__cont))
211 {
return std::rbegin(__cont); }
218 template<
class _Container>
220 crend(
const _Container& __cont) -> decltype(std::rend(__cont))
221 {
return std::rend(__cont); }
225 _GLIBCXX_END_NAMESPACE_VERSION
230 #endif // _GLIBCXX_RANGE_ACCESS_H
auto begin(_Container &__cont) -> decltype(__cont.begin())
Return an iterator pointing to the first element of the container.
auto end(_Container &__cont) -> decltype(__cont.end())
Return an iterator pointing to one past the last element of the container.
ISO C++ entities toplevel namespace is std.