Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:14:01

0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef _LIBCPP___RANGES_ALL_H
0011 #define _LIBCPP___RANGES_ALL_H
0012 
0013 #include <__config>
0014 #include <__functional/compose.h>         // TODO(modules): Those should not be required
0015 #include <__functional/perfect_forward.h> //
0016 #include <__iterator/concepts.h>
0017 #include <__iterator/iterator_traits.h>
0018 #include <__ranges/access.h>
0019 #include <__ranges/concepts.h>
0020 #include <__ranges/owning_view.h>
0021 #include <__ranges/range_adaptor.h>
0022 #include <__ranges/ref_view.h>
0023 #include <__type_traits/decay.h>
0024 #include <__utility/auto_cast.h>
0025 #include <__utility/declval.h>
0026 #include <__utility/forward.h>
0027 
0028 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0029 #  pragma GCC system_header
0030 #endif
0031 
0032 _LIBCPP_BEGIN_NAMESPACE_STD
0033 
0034 #if _LIBCPP_STD_VER >= 20
0035 
0036 namespace ranges::views {
0037 
0038 namespace __all {
0039 struct __fn : __range_adaptor_closure<__fn> {
0040   template <class _Tp>
0041     requires ranges::view<decay_t<_Tp>>
0042   [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(
0043       noexcept(_LIBCPP_AUTO_CAST(std::forward<_Tp>(__t)))) -> decltype(_LIBCPP_AUTO_CAST(std::forward<_Tp>(__t))) {
0044     return _LIBCPP_AUTO_CAST(std::forward<_Tp>(__t));
0045   }
0046 
0047   template <class _Tp>
0048     requires(!ranges::view<decay_t<_Tp>>) && requires(_Tp&& __t) { ranges::ref_view{std::forward<_Tp>(__t)}; }
0049   [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
0050       noexcept(noexcept(ranges::ref_view{std::forward<_Tp>(__t)})) {
0051     return ranges::ref_view{std::forward<_Tp>(__t)};
0052   }
0053 
0054   template <class _Tp>
0055     requires(
0056         !ranges::view<decay_t<_Tp>> && !requires(_Tp&& __t) { ranges::ref_view{std::forward<_Tp>(__t)}; } &&
0057         requires(_Tp&& __t) { ranges::owning_view{std::forward<_Tp>(__t)}; })
0058   [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
0059       noexcept(noexcept(ranges::owning_view{std::forward<_Tp>(__t)})) {
0060     return ranges::owning_view{std::forward<_Tp>(__t)};
0061   }
0062 };
0063 } // namespace __all
0064 
0065 inline namespace __cpo {
0066 inline constexpr auto all = __all::__fn{};
0067 } // namespace __cpo
0068 
0069 template <ranges::viewable_range _Range>
0070 using all_t = decltype(views::all(std::declval<_Range>()));
0071 
0072 } // namespace ranges::views
0073 
0074 #endif // _LIBCPP_STD_VER >= 20
0075 
0076 _LIBCPP_END_NAMESPACE_STD
0077 
0078 #endif // _LIBCPP___RANGES_ALL_H