2 //===----------------------------------------------------------------------===//
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP___ITERATOR_ACCESS_H
11 #define _LIBCPP___ITERATOR_ACCESS_H
14 #include <__cstddef/size_t.h>
16 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
17 # pragma GCC system_header
20 _LIBCPP_BEGIN_NAMESPACE_STD
22 template <class _Tp
, size_t _Np
>
23 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp
* begin(_Tp (&__array
)[_Np
]) _NOEXCEPT
{
27 template <class _Tp
, size_t _Np
>
28 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp
* end(_Tp (&__array
)[_Np
]) _NOEXCEPT
{
32 #if !defined(_LIBCPP_CXX03_LANG)
35 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
auto begin(_Cp
& __c
) -> decltype(__c
.begin()) {
40 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
auto begin(const _Cp
& __c
) -> decltype(__c
.begin()) {
45 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
auto end(_Cp
& __c
) -> decltype(__c
.end()) {
50 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
auto end(const _Cp
& __c
) -> decltype(__c
.end()) {
54 # if _LIBCPP_STD_VER >= 14
57 _LIBCPP_HIDE_FROM_ABI
constexpr auto
58 cbegin(const _Cp
& __c
) noexcept(noexcept(std::begin(__c
))) -> decltype(std::begin(__c
)) {
59 return std::begin(__c
);
63 _LIBCPP_HIDE_FROM_ABI
constexpr auto cend(const _Cp
& __c
) noexcept(noexcept(std::end(__c
))) -> decltype(std::end(__c
)) {
69 #else // defined(_LIBCPP_CXX03_LANG)
72 _LIBCPP_HIDE_FROM_ABI typename
_Cp::iterator
begin(_Cp
& __c
) {
77 _LIBCPP_HIDE_FROM_ABI typename
_Cp::const_iterator
begin(const _Cp
& __c
) {
82 _LIBCPP_HIDE_FROM_ABI typename
_Cp::iterator
end(_Cp
& __c
) {
87 _LIBCPP_HIDE_FROM_ABI typename
_Cp::const_iterator
end(const _Cp
& __c
) {
91 #endif // !defined(_LIBCPP_CXX03_LANG)
93 _LIBCPP_END_NAMESPACE_STD
95 #endif // _LIBCPP___ITERATOR_ACCESS_H