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
102 template<
typename _Tp>
class valarray;
104 template<
typename _Tp> _Tp*
begin(valarray<_Tp>&);
105 template<
typename _Tp>
const _Tp*
begin(
const valarray<_Tp>&);
106 template<
typename _Tp> _Tp*
end(valarray<_Tp>&);
107 template<
typename _Tp>
const _Tp*
end(
const valarray<_Tp>&);
114 template<
class _Container>
115 inline constexpr
auto
116 cbegin(
const _Container& __cont) noexcept(noexcept(
std::begin(__cont)))
125 template<
class _Container>
126 inline constexpr
auto
127 cend(
const _Container& __cont) noexcept(noexcept(
std::end(__cont)))
136 template<
class _Container>
138 rbegin(_Container& __cont) -> decltype(__cont.rbegin())
139 {
return __cont.rbegin(); }
146 template<
class _Container>
148 rbegin(
const _Container& __cont) -> decltype(__cont.rbegin())
149 {
return __cont.rbegin(); }
156 template<
class _Container>
158 rend(_Container& __cont) -> decltype(__cont.rend())
159 {
return __cont.rend(); }
166 template<
class _Container>
168 rend(
const _Container& __cont) -> decltype(__cont.rend())
169 {
return __cont.rend(); }
176 template<
class _Tp,
size_t _Nm>
177 inline reverse_iterator<_Tp*>
178 rbegin(_Tp (&__arr)[_Nm])
179 {
return reverse_iterator<_Tp*>(__arr + _Nm); }
186 template<
class _Tp,
size_t _Nm>
187 inline reverse_iterator<_Tp*>
188 rend(_Tp (&__arr)[_Nm])
189 {
return reverse_iterator<_Tp*>(__arr); }
197 inline reverse_iterator<const _Tp*>
198 rbegin(initializer_list<_Tp> __il)
199 {
return reverse_iterator<const _Tp*>(__il.end()); }
207 inline reverse_iterator<const _Tp*>
208 rend(initializer_list<_Tp> __il)
209 {
return reverse_iterator<const _Tp*>(__il.begin()); }
216 template<
class _Container>
218 crbegin(
const _Container& __cont) -> decltype(std::rbegin(__cont))
219 {
return std::rbegin(__cont); }
226 template<
class _Container>
228 crend(
const _Container& __cont) -> decltype(std::rend(__cont))
229 {
return std::rend(__cont); }
233 _GLIBCXX_END_NAMESPACE_VERSION
238 #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.