30 #ifndef _GLIBCXX_RANGE_ACCESS_H
31 #define _GLIBCXX_RANGE_ACCESS_H 1
33 #pragma GCC system_header
35 #if __cplusplus >= 201103L
40 namespace std _GLIBCXX_VISIBILITY(default)
42 _GLIBCXX_BEGIN_NAMESPACE_VERSION
49 template<
typename _Container>
51 inline _GLIBCXX17_CONSTEXPR
auto
52 begin(_Container& __cont) -> decltype(__cont.begin())
53 {
return __cont.begin(); }
60 template<
typename _Container>
62 inline _GLIBCXX17_CONSTEXPR
auto
63 begin(
const _Container& __cont) -> decltype(__cont.begin())
64 {
return __cont.begin(); }
71 template<
typename _Container>
73 inline _GLIBCXX17_CONSTEXPR
auto
74 end(_Container& __cont) -> decltype(__cont.end())
75 {
return __cont.end(); }
82 template<
typename _Container>
84 inline _GLIBCXX17_CONSTEXPR
auto
85 end(
const _Container& __cont) -> decltype(__cont.end())
86 {
return __cont.end(); }
92 template<
typename _Tp,
size_t _Nm>
94 inline _GLIBCXX14_CONSTEXPR _Tp*
95 begin(_Tp (&__arr)[_Nm]) noexcept
103 template<
typename _Tp,
size_t _Nm>
105 inline _GLIBCXX14_CONSTEXPR _Tp*
106 end(_Tp (&__arr)[_Nm]) noexcept
107 {
return __arr + _Nm; }
109 #if __cplusplus >= 201402L
111 template<
typename _Tp>
class valarray;
113 template<
typename _Tp> _Tp*
begin(valarray<_Tp>&) noexcept;
114 template<typename _Tp> const _Tp*
begin(const valarray<_Tp>&) noexcept;
115 template<typename _Tp> _Tp*
end(valarray<_Tp>&) noexcept;
116 template<typename _Tp> const _Tp*
end(const valarray<_Tp>&) noexcept;
123 template<typename _Container>
126 cbegin(const _Container& __cont) noexcept(noexcept(std::
begin(__cont)))
127 -> decltype(std::
begin(__cont))
135 template<
typename _Container>
147 template<
typename _Container>
149 inline _GLIBCXX17_CONSTEXPR
auto
150 rbegin(_Container& __cont) -> decltype(__cont.rbegin())
151 {
return __cont.rbegin(); }
158 template<
typename _Container>
160 inline _GLIBCXX17_CONSTEXPR
auto
161 rbegin(
const _Container& __cont) -> decltype(__cont.rbegin())
162 {
return __cont.rbegin(); }
169 template<
typename _Container>
171 inline _GLIBCXX17_CONSTEXPR
auto
172 rend(_Container& __cont) -> decltype(__cont.rend())
173 {
return __cont.rend(); }
180 template<
typename _Container>
182 inline _GLIBCXX17_CONSTEXPR
auto
183 rend(
const _Container& __cont) -> decltype(__cont.rend())
184 {
return __cont.rend(); }
191 template<
typename _Tp,
size_t _Nm>
193 inline _GLIBCXX17_CONSTEXPR reverse_iterator<_Tp*>
202 template<
typename _Tp,
size_t _Nm>
204 inline _GLIBCXX17_CONSTEXPR reverse_iterator<_Tp*>
205 rend(_Tp (&__arr)[_Nm]) noexcept
213 template<
typename _Tp>
215 inline _GLIBCXX17_CONSTEXPR reverse_iterator<const _Tp*>
224 template<
typename _Tp>
226 inline _GLIBCXX17_CONSTEXPR reverse_iterator<const _Tp*>
235 template<
typename _Container>
237 inline _GLIBCXX17_CONSTEXPR
auto
246 template<
typename _Container>
248 inline _GLIBCXX17_CONSTEXPR
auto
254 #if __cplusplus >= 201703L
255 #define __cpp_lib_nonmember_container_access 201411L
261 template <
typename _Container>
264 size(
const _Container& __cont) noexcept(noexcept(__cont.size()))
265 -> decltype(__cont.size())
266 {
return __cont.size(); }
271 template <
typename _Tp,
size_t _Nm>
274 size(
const _Tp (&)[_Nm]) noexcept
281 template <
typename _Container>
282 [[nodiscard]] constexpr
auto
283 empty(
const _Container& __cont) noexcept(noexcept(__cont.empty()))
284 -> decltype(__cont.empty())
285 {
return __cont.empty(); }
290 template <
typename _Tp,
size_t _Nm>
291 [[nodiscard]] constexpr
bool
299 template <
typename _Tp>
300 [[nodiscard]] constexpr
bool
302 {
return __il.size() == 0;}
308 template <
typename _Container>
311 data(_Container& __cont) noexcept(noexcept(__cont.data()))
312 -> decltype(__cont.data())
313 {
return __cont.data(); }
319 template <
typename _Container>
322 data(
const _Container& __cont) noexcept(noexcept(__cont.data()))
323 -> decltype(__cont.data())
324 {
return __cont.data(); }
330 template <
typename _Tp,
size_t _Nm>
333 data(_Tp (&__array)[_Nm]) noexcept
340 template <
typename _Tp>
344 {
return __il.begin(); }
346 #if __cplusplus > 201703L
347 #define __cpp_lib_ssize 201902L
348 template<
typename _Container>
351 ssize(
const _Container& __cont)
352 noexcept(noexcept(__cont.size()))
356 return static_cast<common_type_t<ptrdiff_t, type>
>(__cont.size());
359 template<
typename _Tp, ptrdiff_t _Num>
362 ssize(
const _Tp (&)[_Num]) noexcept
367 _GLIBCXX_END_NAMESPACE_VERSION
371 #endif // _GLIBCXX_RANGE_ACCESS_H
constexpr auto rbegin(_Container &__cont) -> decltype(__cont.rbegin())
Return a reverse iterator pointing to the last element of the container.
_Tp * end(valarray< _Tp > &__va) noexcept
Return an iterator pointing to one past the last element of the valarray.
_Tp * begin(valarray< _Tp > &__va) noexcept
Return an iterator pointing to the first element of the valarray.
typename make_signed< _Tp >::type make_signed_t
Alias template for make_signed.
typename common_type< _Tp...>::type common_type_t
Alias template for common_type.
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.
constexpr auto size(const _Container &__cont) noexcept(noexcept(__cont.size())) -> decltype(__cont.size())
Return the size of a container.
constexpr auto empty(const _Container &__cont) noexcept(noexcept(__cont.empty())) -> decltype(__cont.empty())
Return whether a container is empty.
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.
constexpr auto data(_Container &__cont) noexcept(noexcept(__cont.data())) -> decltype(__cont.data())
Return the data pointer of a container.
constexpr auto rend(_Container &__cont) -> decltype(__cont.rend())
Return a reverse iterator pointing one past the first element of the container.
constexpr auto crend(const _Container &__cont) -> decltype(std::rend(__cont))
Return a reverse iterator pointing one past the first element of the const container.