1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
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
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP___ITERATOR_ACCESS_H
11#define _LIBCPP___ITERATOR_ACCESS_H
12
13#include <__config>
14#include <cstddef>
15
16#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
17# pragma GCC system_header
18#endif
19
20_LIBCPP_BEGIN_NAMESPACE_STD
21
22template <class _Tp, size_t _Np>
23_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
24_Tp*
25begin(_Tp (&__array)[_Np])
26{
27 return __array;
28}
29
30template <class _Tp, size_t _Np>
31_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
32_Tp*
33end(_Tp (&__array)[_Np])
34{
35 return __array + _Np;
36}
37
38#if !defined(_LIBCPP_CXX03_LANG)
39
40template <class _Cp>
41_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
42auto
43begin(_Cp& __c) -> decltype(__c.begin())
44{
45 return __c.begin();
46}
47
48template <class _Cp>
49_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
50auto
51begin(const _Cp& __c) -> decltype(__c.begin())
52{
53 return __c.begin();
54}
55
56template <class _Cp>
57_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
58auto
59end(_Cp& __c) -> decltype(__c.end())
60{
61 return __c.end();
62}
63
64template <class _Cp>
65_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
66auto
67end(const _Cp& __c) -> decltype(__c.end())
68{
69 return __c.end();
70}
71
72#if _LIBCPP_STD_VER > 11
73
74template <class _Cp>
75_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
76auto cbegin(const _Cp& __c) -> decltype(_VSTD::begin(__c))
77{
78 return _VSTD::begin(__c);
79}
80
81template <class _Cp>
82_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
83auto cend(const _Cp& __c) -> decltype(_VSTD::end(__c))
84{
85 return _VSTD::end(__c);
86}
87
88#endif
89
90
91#else // defined(_LIBCPP_CXX03_LANG)
92
93template <class _Cp>
94_LIBCPP_INLINE_VISIBILITY
95typename _Cp::iterator
96begin(_Cp& __c)
97{
98 return __c.begin();
99}
100
101template <class _Cp>
102_LIBCPP_INLINE_VISIBILITY
103typename _Cp::const_iterator
104begin(const _Cp& __c)
105{
106 return __c.begin();
107}
108
109template <class _Cp>
110_LIBCPP_INLINE_VISIBILITY
111typename _Cp::iterator
112end(_Cp& __c)
113{
114 return __c.end();
115}
116
117template <class _Cp>
118_LIBCPP_INLINE_VISIBILITY
119typename _Cp::const_iterator
120end(const _Cp& __c)
121{
122 return __c.end();
123}
124
125#endif // !defined(_LIBCPP_CXX03_LANG)
126
127_LIBCPP_END_NAMESPACE_STD
128
129#endif // _LIBCPP___ITERATOR_ACCESS_H
130

source code of flutter_engine/third_party/libcxx/include/__iterator/access.h