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_REVERSE_ACCESS_H
11#define _LIBCPP___ITERATOR_REVERSE_ACCESS_H
12
13#include <__config>
14#include <__iterator/reverse_iterator.h>
15#include <cstddef>
16#include <initializer_list>
17
18#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
19# pragma GCC system_header
20#endif
21
22_LIBCPP_BEGIN_NAMESPACE_STD
23
24#if _LIBCPP_STD_VER > 11
25
26template <class _Tp, size_t _Np>
27_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
28reverse_iterator<_Tp*> rbegin(_Tp (&__array)[_Np])
29{
30 return reverse_iterator<_Tp*>(__array + _Np);
31}
32
33template <class _Tp, size_t _Np>
34_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
35reverse_iterator<_Tp*> rend(_Tp (&__array)[_Np])
36{
37 return reverse_iterator<_Tp*>(__array);
38}
39
40template <class _Ep>
41_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
42reverse_iterator<const _Ep*> rbegin(initializer_list<_Ep> __il)
43{
44 return reverse_iterator<const _Ep*>(__il.end());
45}
46
47template <class _Ep>
48_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
49reverse_iterator<const _Ep*> rend(initializer_list<_Ep> __il)
50{
51 return reverse_iterator<const _Ep*>(__il.begin());
52}
53
54template <class _Cp>
55_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
56auto rbegin(_Cp& __c) -> decltype(__c.rbegin())
57{
58 return __c.rbegin();
59}
60
61template <class _Cp>
62_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
63auto rbegin(const _Cp& __c) -> decltype(__c.rbegin())
64{
65 return __c.rbegin();
66}
67
68template <class _Cp>
69_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
70auto rend(_Cp& __c) -> decltype(__c.rend())
71{
72 return __c.rend();
73}
74
75template <class _Cp>
76_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
77auto rend(const _Cp& __c) -> decltype(__c.rend())
78{
79 return __c.rend();
80}
81
82template <class _Cp>
83_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
84auto crbegin(const _Cp& __c) -> decltype(_VSTD::rbegin(__c))
85{
86 return _VSTD::rbegin(__c);
87}
88
89template <class _Cp>
90_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
91auto crend(const _Cp& __c) -> decltype(_VSTD::rend(__c))
92{
93 return _VSTD::rend(__c);
94}
95
96#endif // _LIBCPP_STD_VER > 11
97
98_LIBCPP_END_NAMESPACE_STD
99
100#endif // _LIBCPP___ITERATOR_REVERSE_ACCESS_H
101

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