Path: blob/main/contrib/llvm-project/libcxx/include/__ranges/all.h
35236 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___RANGES_ALL_H10#define _LIBCPP___RANGES_ALL_H1112#include <__config>13#include <__functional/compose.h> // TODO(modules): Those should not be required14#include <__functional/perfect_forward.h> //15#include <__iterator/concepts.h>16#include <__iterator/iterator_traits.h>17#include <__ranges/access.h>18#include <__ranges/concepts.h>19#include <__ranges/owning_view.h>20#include <__ranges/range_adaptor.h>21#include <__ranges/ref_view.h>22#include <__type_traits/decay.h>23#include <__utility/auto_cast.h>24#include <__utility/declval.h>25#include <__utility/forward.h>2627#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)28# pragma GCC system_header29#endif3031_LIBCPP_BEGIN_NAMESPACE_STD3233#if _LIBCPP_STD_VER >= 203435namespace ranges::views {3637namespace __all {38struct __fn : __range_adaptor_closure<__fn> {39template <class _Tp>40requires ranges::view<decay_t<_Tp>>41[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(42noexcept(_LIBCPP_AUTO_CAST(std::forward<_Tp>(__t)))) -> decltype(_LIBCPP_AUTO_CAST(std::forward<_Tp>(__t))) {43return _LIBCPP_AUTO_CAST(std::forward<_Tp>(__t));44}4546template <class _Tp>47requires(!ranges::view<decay_t<_Tp>>) && requires(_Tp&& __t) { ranges::ref_view{std::forward<_Tp>(__t)}; }48[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const49noexcept(noexcept(ranges::ref_view{std::forward<_Tp>(__t)})) {50return ranges::ref_view{std::forward<_Tp>(__t)};51}5253template <class _Tp>54requires(55!ranges::view<decay_t<_Tp>> && !requires(_Tp&& __t) { ranges::ref_view{std::forward<_Tp>(__t)}; } &&56requires(_Tp&& __t) { ranges::owning_view{std::forward<_Tp>(__t)}; })57[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const58noexcept(noexcept(ranges::owning_view{std::forward<_Tp>(__t)})) {59return ranges::owning_view{std::forward<_Tp>(__t)};60}61};62} // namespace __all6364inline namespace __cpo {65inline constexpr auto all = __all::__fn{};66} // namespace __cpo6768template <ranges::viewable_range _Range>69using all_t = decltype(views::all(std::declval<_Range>()));7071} // namespace ranges::views7273#endif // _LIBCPP_STD_VER >= 207475_LIBCPP_END_NAMESPACE_STD7677#endif // _LIBCPP___RANGES_ALL_H787980