Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / include / __iterator / reverse_access.h
blobb8c5a071cc63f6b73537df1b7454f5f428322aa5
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 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP___ITERATOR_REVERSE_ACCESS_H
11 #define _LIBCPP___ITERATOR_REVERSE_ACCESS_H
13 #include <__config>
14 #include <__iterator/reverse_iterator.h>
15 #include <cstddef>
16 #include <initializer_list>
18 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
19 # pragma GCC system_header
20 #endif
22 _LIBCPP_BEGIN_NAMESPACE_STD
24 #if _LIBCPP_STD_VER >= 14
26 template <class _Tp, size_t _Np>
27 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17
28 reverse_iterator<_Tp*> rbegin(_Tp (&__array)[_Np])
30 return reverse_iterator<_Tp*>(__array + _Np);
33 template <class _Tp, size_t _Np>
34 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17
35 reverse_iterator<_Tp*> rend(_Tp (&__array)[_Np])
37 return reverse_iterator<_Tp*>(__array);
40 template <class _Ep>
41 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17
42 reverse_iterator<const _Ep*> rbegin(initializer_list<_Ep> __il)
44 return reverse_iterator<const _Ep*>(__il.end());
47 template <class _Ep>
48 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17
49 reverse_iterator<const _Ep*> rend(initializer_list<_Ep> __il)
51 return reverse_iterator<const _Ep*>(__il.begin());
54 template <class _Cp>
55 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17
56 auto rbegin(_Cp& __c) -> decltype(__c.rbegin())
58 return __c.rbegin();
61 template <class _Cp>
62 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17
63 auto rbegin(const _Cp& __c) -> decltype(__c.rbegin())
65 return __c.rbegin();
68 template <class _Cp>
69 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17
70 auto rend(_Cp& __c) -> decltype(__c.rend())
72 return __c.rend();
75 template <class _Cp>
76 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17
77 auto rend(const _Cp& __c) -> decltype(__c.rend())
79 return __c.rend();
82 template <class _Cp>
83 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17
84 auto crbegin(const _Cp& __c) -> decltype(_VSTD::rbegin(__c))
86 return _VSTD::rbegin(__c);
89 template <class _Cp>
90 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17
91 auto crend(const _Cp& __c) -> decltype(_VSTD::rend(__c))
93 return _VSTD::rend(__c);
96 #endif // _LIBCPP_STD_VER >= 14
98 _LIBCPP_END_NAMESPACE_STD
100 #endif // _LIBCPP___ITERATOR_REVERSE_ACCESS_H