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
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_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17
37 begin(_Cp
& __c
) -> decltype(__c
.begin())
43 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17
45 begin(const _Cp
& __c
) -> decltype(__c
.begin())
51 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17
53 end(_Cp
& __c
) -> decltype(__c
.end())
59 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17
61 end(const _Cp
& __c
) -> decltype(__c
.end())
66 #if _LIBCPP_STD_VER >= 14
69 _LIBCPP_HIDE_FROM_ABI
constexpr auto cbegin(const _Cp
& __c
) noexcept(noexcept(std::begin(__c
)))
70 -> decltype(std::begin(__c
)) {
71 return std::begin(__c
);
75 _LIBCPP_HIDE_FROM_ABI
constexpr auto cend(const _Cp
& __c
) noexcept(noexcept(std::end(__c
))) -> decltype(std::end(__c
)) {
82 #else // defined(_LIBCPP_CXX03_LANG)
85 _LIBCPP_INLINE_VISIBILITY
86 typename
_Cp::iterator
93 _LIBCPP_INLINE_VISIBILITY
94 typename
_Cp::const_iterator
101 _LIBCPP_INLINE_VISIBILITY
102 typename
_Cp::iterator
109 _LIBCPP_INLINE_VISIBILITY
110 typename
_Cp::const_iterator
116 #endif // !defined(_LIBCPP_CXX03_LANG)
118 _LIBCPP_END_NAMESPACE_STD
120 #endif // _LIBCPP___ITERATOR_ACCESS_H