30 #ifndef _GLIBCXX_RANGE_ACCESS_H
31 #define _GLIBCXX_RANGE_ACCESS_H 1
33 #pragma GCC system_header
35 #if __cplusplus >= 201103L
39 namespace std _GLIBCXX_VISIBILITY(default)
41 _GLIBCXX_BEGIN_NAMESPACE_VERSION
48 template<
typename _Container>
49 inline _GLIBCXX17_CONSTEXPR
auto
50 begin(_Container& __cont) -> decltype(__cont.begin())
51 {
return __cont.begin(); }
58 template<
typename _Container>
59 inline _GLIBCXX17_CONSTEXPR
auto
60 begin(
const _Container& __cont) -> decltype(__cont.begin())
61 {
return __cont.begin(); }
68 template<
typename _Container>
69 inline _GLIBCXX17_CONSTEXPR
auto
70 end(_Container& __cont) -> decltype(__cont.end())
71 {
return __cont.end(); }
78 template<
typename _Container>
79 inline _GLIBCXX17_CONSTEXPR
auto
80 end(
const _Container& __cont) -> decltype(__cont.end())
81 {
return __cont.end(); }
87 template<
typename _Tp,
size_t _Nm>
88 inline _GLIBCXX14_CONSTEXPR _Tp*
97 template<
typename _Tp,
size_t _Nm>
98 inline _GLIBCXX14_CONSTEXPR _Tp*
99 end(_Tp (&__arr)[_Nm])
100 {
return __arr + _Nm; }
102 #if __cplusplus >= 201402L
104 template<
typename _Tp>
class valarray;
106 template<
typename _Tp> _Tp*
begin(valarray<_Tp>&);
107 template<
typename _Tp>
const _Tp*
begin(
const valarray<_Tp>&);
108 template<
typename _Tp> _Tp*
end(valarray<_Tp>&);
109 template<
typename _Tp>
const _Tp*
end(
const valarray<_Tp>&);
116 template<
typename _Container>
117 inline constexpr
auto
127 template<
typename _Container>
128 inline constexpr
auto
138 template<
typename _Container>
139 inline _GLIBCXX17_CONSTEXPR
auto
140 rbegin(_Container& __cont) -> decltype(__cont.rbegin())
141 {
return __cont.rbegin(); }
148 template<
typename _Container>
149 inline _GLIBCXX17_CONSTEXPR
auto
150 rbegin(
const _Container& __cont) -> decltype(__cont.rbegin())
151 {
return __cont.rbegin(); }
158 template<
typename _Container>
159 inline _GLIBCXX17_CONSTEXPR
auto
160 rend(_Container& __cont) -> decltype(__cont.rend())
161 {
return __cont.rend(); }
168 template<
typename _Container>
169 inline _GLIBCXX17_CONSTEXPR
auto
170 rend(
const _Container& __cont) -> decltype(__cont.rend())
171 {
return __cont.rend(); }
178 template<
typename _Tp,
size_t _Nm>
179 inline _GLIBCXX17_CONSTEXPR reverse_iterator<_Tp*>
188 template<
typename _Tp,
size_t _Nm>
189 inline _GLIBCXX17_CONSTEXPR reverse_iterator<_Tp*>
198 template<
typename _Tp>
199 inline _GLIBCXX17_CONSTEXPR reverse_iterator<const _Tp*>
208 template<
typename _Tp>
209 inline _GLIBCXX17_CONSTEXPR reverse_iterator<const _Tp*>
218 template<
typename _Container>
219 inline _GLIBCXX17_CONSTEXPR
auto
228 template<
typename _Container>
229 inline _GLIBCXX17_CONSTEXPR
auto
235 #if __cplusplus >= 201703L
236 #define __cpp_lib_nonmember_container_access 201411
242 template <
typename _Container>
244 size(
const _Container& __cont) noexcept(noexcept(__cont.size()))
245 -> decltype(__cont.size())
246 {
return __cont.size(); }
251 template <
typename _Tp,
size_t _Nm>
253 size(
const _Tp (&)[_Nm]) noexcept
260 template <
typename _Container>
261 [[nodiscard]] constexpr
auto
262 empty(
const _Container& __cont) noexcept(noexcept(__cont.empty()))
263 -> decltype(__cont.empty())
264 {
return __cont.empty(); }
269 template <
typename _Tp,
size_t _Nm>
270 [[nodiscard]] constexpr
bool
278 template <
typename _Tp>
279 [[nodiscard]] constexpr
bool
281 {
return __il.size() == 0;}
287 template <
typename _Container>
289 data(_Container& __cont) noexcept(noexcept(__cont.data()))
290 -> decltype(__cont.data())
291 {
return __cont.data(); }
297 template <
typename _Container>
299 data(
const _Container& __cont) noexcept(noexcept(__cont.data()))
300 -> decltype(__cont.data())
301 {
return __cont.data(); }
307 template <
typename _Tp,
size_t _Nm>
309 data(_Tp (&__array)[_Nm]) noexcept
316 template <
typename _Tp>
319 {
return __il.begin(); }
321 #if __cplusplus > 201703L
322 #define __cpp_lib_ssize 201902L
323 template<
typename _Container>
325 ssize(
const _Container& __cont)
326 noexcept(noexcept(__cont.size()))
330 return static_cast<common_type_t<ptrdiff_t, type>
>(__cont.size());
333 template<
typename _Tp, ptrdiff_t _Num>
335 ssize(
const _Tp (&)[_Num]) noexcept
340 _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 * begin(valarray< _Tp > &__va)
Return an iterator pointing to the first element of the valarray.
_Tp * end(valarray< _Tp > &__va)
Return an iterator pointing to one past the last 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.