Path: blob/main/contrib/llvm-project/libcxx/include/__iterator/reverse_access.h
35234 views
// -*- C++ -*-1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//89#ifndef _LIBCPP___ITERATOR_REVERSE_ACCESS_H10#define _LIBCPP___ITERATOR_REVERSE_ACCESS_H1112#include <__config>13#include <__iterator/reverse_iterator.h>14#include <cstddef>15#include <initializer_list>1617#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)18# pragma GCC system_header19#endif2021_LIBCPP_BEGIN_NAMESPACE_STD2223#if _LIBCPP_STD_VER >= 142425template <class _Tp, size_t _Np>26_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Tp*> rbegin(_Tp (&__array)[_Np]) {27return reverse_iterator<_Tp*>(__array + _Np);28}2930template <class _Tp, size_t _Np>31_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Tp*> rend(_Tp (&__array)[_Np]) {32return reverse_iterator<_Tp*>(__array);33}3435template <class _Ep>36_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<const _Ep*> rbegin(initializer_list<_Ep> __il) {37return reverse_iterator<const _Ep*>(__il.end());38}3940template <class _Ep>41_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<const _Ep*> rend(initializer_list<_Ep> __il) {42return reverse_iterator<const _Ep*>(__il.begin());43}4445template <class _Cp>46_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rbegin(_Cp& __c) -> decltype(__c.rbegin()) {47return __c.rbegin();48}4950template <class _Cp>51_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rbegin(const _Cp& __c) -> decltype(__c.rbegin()) {52return __c.rbegin();53}5455template <class _Cp>56_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rend(_Cp& __c) -> decltype(__c.rend()) {57return __c.rend();58}5960template <class _Cp>61_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rend(const _Cp& __c) -> decltype(__c.rend()) {62return __c.rend();63}6465template <class _Cp>66_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto crbegin(const _Cp& __c) -> decltype(std::rbegin(__c)) {67return std::rbegin(__c);68}6970template <class _Cp>71_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto crend(const _Cp& __c) -> decltype(std::rend(__c)) {72return std::rend(__c);73}7475#endif // _LIBCPP_STD_VER >= 147677_LIBCPP_END_NAMESPACE_STD7879#endif // _LIBCPP___ITERATOR_REVERSE_ACCESS_H808182