30 #ifndef _GLIBCXX_RANGE_ACCESS_H
31 #define _GLIBCXX_RANGE_ACCESS_H 1
33 #pragma GCC system_header
35 #if __cplusplus >= 201103L
37 namespace std _GLIBCXX_VISIBILITY(default)
39 _GLIBCXX_BEGIN_NAMESPACE_VERSION
46 template<
typename _Container>
47 inline _GLIBCXX17_CONSTEXPR
auto
48 begin(_Container& __cont) -> decltype(__cont.begin())
49 {
return __cont.begin(); }
56 template<
typename _Container>
57 inline _GLIBCXX17_CONSTEXPR
auto
58 begin(
const _Container& __cont) -> decltype(__cont.begin())
59 {
return __cont.begin(); }
66 template<
typename _Container>
67 inline _GLIBCXX17_CONSTEXPR
auto
68 end(_Container& __cont) -> decltype(__cont.end())
69 {
return __cont.end(); }
76 template<
typename _Container>
77 inline _GLIBCXX17_CONSTEXPR
auto
78 end(
const _Container& __cont) -> decltype(__cont.end())
79 {
return __cont.end(); }
85 template<
typename _Tp,
size_t _Nm>
86 inline _GLIBCXX14_CONSTEXPR _Tp*
87 begin(_Tp (&__arr)[_Nm])
95 template<
typename _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<
typename _Container>
115 inline constexpr
auto
125 template<
typename _Container>
126 inline constexpr
auto
136 template<
typename _Container>
137 inline _GLIBCXX17_CONSTEXPR
auto
138 rbegin(_Container& __cont) -> decltype(__cont.rbegin())
139 {
return __cont.rbegin(); }
146 template<
typename _Container>
147 inline _GLIBCXX17_CONSTEXPR
auto
148 rbegin(
const _Container& __cont) -> decltype(__cont.rbegin())
149 {
return __cont.rbegin(); }
156 template<
typename _Container>
157 inline _GLIBCXX17_CONSTEXPR
auto
158 rend(_Container& __cont) -> decltype(__cont.rend())
159 {
return __cont.rend(); }
166 template<
typename _Container>
167 inline _GLIBCXX17_CONSTEXPR
auto
168 rend(
const _Container& __cont) -> decltype(__cont.rend())
169 {
return __cont.rend(); }
176 template<
typename _Tp,
size_t _Nm>
186 template<
typename _Tp,
size_t _Nm>
188 rend(_Tp (&__arr)[_Nm])
196 template<
typename _Tp>
197 inline _GLIBCXX17_CONSTEXPR reverse_iterator<const _Tp*>
206 template<
typename _Tp>
207 inline _GLIBCXX17_CONSTEXPR reverse_iterator<const _Tp*>
216 template<
typename _Container>
217 inline _GLIBCXX17_CONSTEXPR
auto
226 template<
typename _Container>
227 inline _GLIBCXX17_CONSTEXPR
auto
233 #if __cplusplus >= 201703L
234 #define __cpp_lib_nonmember_container_access 201411
240 template <
typename _Container>
243 -> decltype(__cont.size())
244 {
return __cont.size(); }
250 template <
typename _Tp,
size_t _Nm>
259 template <
typename _Container>
260 [[nodiscard]] constexpr
auto
262 -> decltype(__cont.empty())
263 {
return __cont.empty(); }
269 template <
typename _Tp,
size_t _Nm>
270 [[nodiscard]] constexpr
bool
278 template <
typename _Tp>
279 [[nodiscard]] constexpr
bool
280 empty(initializer_list<_Tp> __il)
noexcept
281 {
return __il.size() == 0;}
287 template <
typename _Container>
290 -> decltype(__cont.data())
291 {
return __cont.data(); }
297 template <
typename _Container>
300 -> decltype(__cont.data())
301 {
return __cont.data(); }
307 template <
typename _Tp,
size_t _Nm>
316 template <
typename _Tp>
318 data(initializer_list<_Tp> __il)
noexcept
319 {
return __il.begin(); }
323 _GLIBCXX_END_NAMESPACE_VERSION
328 #endif // _GLIBCXX_RANGE_ACCESS_H
_GLIBCXX17_CONSTEXPR auto rbegin(_Container &__cont) -> decltype(__cont.rbegin())
Return a reverse iterator pointing to the last element of the container.
constexpr const _Tp * end(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to one past the last element of the initializer_list. ...
_GLIBCXX17_CONSTEXPR reverse_iterator< _Tp * >
Return a reverse iterator pointing to the last element of the array.
_GLIBCXX17_CONSTEXPR auto crbegin(const _Container &__cont) -> decltype(std::rbegin(__cont))
Return a reverse iterator pointing to the last element of the const container.
constexpr auto cend(const _Container &__cont) noexcept(noexcept(std::end(__cont))) -> decltype(std::end(__cont))
Return an iterator pointing to one past the last element of the const container.
enable_if< ::__array_traits< _Tp, _Nm >::_Is_swappable::value >::type noexcept(noexcept(__one.swap(__two)))
swap
_GLIBCXX17_CONSTEXPR auto crend(const _Container &__cont) -> decltype(std::rend(__cont))
Return a reverse iterator pointing one past the first element of the const container.
constexpr const _Tp * begin(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to the first element of the initializer_list.
constexpr auto cbegin(const _Container &__cont) noexcept(noexcept(std::begin(__cont))) -> decltype(std::begin(__cont))
Return an iterator pointing to the first element of the const container.
_GLIBCXX17_CONSTEXPR auto rend(_Container &__cont) -> decltype(__cont.rend())
Return a reverse iterator pointing one past the first element of the container.