30#ifndef _GLIBCXX_RANGE_ACCESS_H
31#define _GLIBCXX_RANGE_ACCESS_H 1
33#pragma GCC system_header
35#if __cplusplus >= 201103L
40namespace std _GLIBCXX_VISIBILITY(default)
42_GLIBCXX_BEGIN_NAMESPACE_VERSION
49 template<
typename _Container>
50 inline _GLIBCXX17_CONSTEXPR
auto
51 begin(_Container& __cont) ->
decltype(__cont.begin())
52 {
return __cont.begin(); }
59 template<
typename _Container>
60 inline _GLIBCXX17_CONSTEXPR
auto
61 begin(
const _Container& __cont) ->
decltype(__cont.begin())
62 {
return __cont.begin(); }
69 template<
typename _Container>
70 inline _GLIBCXX17_CONSTEXPR
auto
71 end(_Container& __cont) ->
decltype(__cont.end())
72 {
return __cont.end(); }
79 template<
typename _Container>
80 inline _GLIBCXX17_CONSTEXPR
auto
81 end(
const _Container& __cont) ->
decltype(__cont.end())
82 {
return __cont.end(); }
88 template<
typename _Tp,
size_t _Nm>
89 inline _GLIBCXX14_CONSTEXPR _Tp*
90 begin(_Tp (&__arr)[_Nm])
noexcept
98 template<
typename _Tp,
size_t _Nm>
99 inline _GLIBCXX14_CONSTEXPR _Tp*
100 end(_Tp (&__arr)[_Nm])
noexcept
101 {
return __arr + _Nm; }
103#if __cplusplus >= 201402L
105 template<
typename _Tp>
class valarray;
107 template<
typename _Tp> _Tp*
begin(valarray<_Tp>&)
noexcept;
108 template<
typename _Tp>
const _Tp*
begin(
const valarray<_Tp>&)
noexcept;
109 template<
typename _Tp> _Tp*
end(valarray<_Tp>&)
noexcept;
110 template<
typename _Tp>
const _Tp*
end(
const valarray<_Tp>&)
noexcept;
117 template<
typename _Container>
118 inline constexpr auto
128 template<
typename _Container>
129 inline constexpr auto
139 template<
typename _Container>
140 inline _GLIBCXX17_CONSTEXPR
auto
141 rbegin(_Container& __cont) ->
decltype(__cont.rbegin())
142 {
return __cont.rbegin(); }
149 template<
typename _Container>
150 inline _GLIBCXX17_CONSTEXPR
auto
151 rbegin(
const _Container& __cont) ->
decltype(__cont.rbegin())
152 {
return __cont.rbegin(); }
159 template<
typename _Container>
160 inline _GLIBCXX17_CONSTEXPR
auto
161 rend(_Container& __cont) ->
decltype(__cont.rend())
162 {
return __cont.rend(); }
169 template<
typename _Container>
170 inline _GLIBCXX17_CONSTEXPR
auto
171 rend(
const _Container& __cont) ->
decltype(__cont.rend())
172 {
return __cont.rend(); }
179 template<
typename _Tp,
size_t _Nm>
180 inline _GLIBCXX17_CONSTEXPR reverse_iterator<_Tp*>
189 template<
typename _Tp,
size_t _Nm>
190 inline _GLIBCXX17_CONSTEXPR reverse_iterator<_Tp*>
191 rend(_Tp (&__arr)[_Nm])
noexcept
199 template<
typename _Tp>
200 inline _GLIBCXX17_CONSTEXPR reverse_iterator<const _Tp*>
209 template<
typename _Tp>
210 inline _GLIBCXX17_CONSTEXPR reverse_iterator<const _Tp*>
219 template<
typename _Container>
220 inline _GLIBCXX17_CONSTEXPR
auto
229 template<
typename _Container>
230 inline _GLIBCXX17_CONSTEXPR
auto
236#if __cplusplus >= 201703L
237#define __cpp_lib_nonmember_container_access 201411
243 template <
typename _Container>
245 size(
const _Container& __cont)
noexcept(
noexcept(__cont.size()))
246 ->
decltype(__cont.size())
247 {
return __cont.size(); }
252 template <
typename _Tp,
size_t _Nm>
254 size(
const _Tp (&)[_Nm])
noexcept
261 template <
typename _Container>
262 [[nodiscard]]
constexpr auto
263 empty(
const _Container& __cont)
noexcept(
noexcept(__cont.empty()))
264 ->
decltype(__cont.empty())
265 {
return __cont.empty(); }
270 template <
typename _Tp,
size_t _Nm>
271 [[nodiscard]]
constexpr bool
279 template <
typename _Tp>
280 [[nodiscard]]
constexpr bool
282 {
return __il.size() == 0;}
288 template <
typename _Container>
290 data(_Container& __cont)
noexcept(
noexcept(__cont.data()))
291 ->
decltype(__cont.data())
292 {
return __cont.data(); }
298 template <
typename _Container>
300 data(
const _Container& __cont)
noexcept(
noexcept(__cont.data()))
301 ->
decltype(__cont.data())
302 {
return __cont.data(); }
308 template <
typename _Tp,
size_t _Nm>
310 data(_Tp (&__array)[_Nm])
noexcept
317 template <
typename _Tp>
320 {
return __il.begin(); }
322#if __cplusplus > 201703L
323#define __cpp_lib_ssize 201902L
324 template<
typename _Container>
326 ssize(
const _Container& __cont)
327 noexcept(
noexcept(__cont.size()))
331 return static_cast<common_type_t<ptrdiff_t, type>
>(__cont.size());
334 template<
typename _Tp, ptrdiff_t _Num>
336 ssize(
const _Tp (&)[_Num])
noexcept
341_GLIBCXX_END_NAMESPACE_VERSION
typename common_type< _Tp... >::type common_type_t
Alias template for common_type.
typename make_signed< _Tp >::type make_signed_t
Alias template for make_signed.
_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.
ISO C++ entities toplevel namespace is std.
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 auto rend(_Container &__cont) -> decltype(__cont.rend())
Return a reverse iterator pointing one past the first element of the 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 empty(const _Container &__cont) noexcept(noexcept(__cont.empty())) -> decltype(__cont.empty())
Return whether a container is empty.
constexpr auto size(const _Container &__cont) noexcept(noexcept(__cont.size())) -> decltype(__cont.size())
Return the size of a container.
constexpr auto rbegin(_Container &__cont) -> decltype(__cont.rbegin())
Return a reverse iterator pointing to the last element of the container.
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 data(_Container &__cont) noexcept(noexcept(__cont.data())) -> decltype(__cont.data())
Return the data pointer of a container.
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.