Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:13:33

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___CXX03___ITERATOR_PROJECTED_H
0011 #define _LIBCPP___CXX03___ITERATOR_PROJECTED_H
0012 
0013 #include <__cxx03/__config>
0014 #include <__cxx03/__iterator/concepts.h>
0015 #include <__cxx03/__iterator/incrementable_traits.h> // iter_difference_t
0016 #include <__cxx03/__type_traits/remove_cvref.h>
0017 
0018 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0019 #  pragma GCC system_header
0020 #endif
0021 
0022 _LIBCPP_BEGIN_NAMESPACE_STD
0023 
0024 #if _LIBCPP_STD_VER >= 20
0025 
0026 template <class _It, class _Proj>
0027 struct __projected_impl {
0028   struct __type {
0029     using value_type = remove_cvref_t<indirect_result_t<_Proj&, _It>>;
0030     indirect_result_t<_Proj&, _It> operator*() const; // not defined
0031   };
0032 };
0033 
0034 template <weakly_incrementable _It, class _Proj>
0035 struct __projected_impl<_It, _Proj> {
0036   struct __type {
0037     using value_type      = remove_cvref_t<indirect_result_t<_Proj&, _It>>;
0038     using difference_type = iter_difference_t<_It>;
0039     indirect_result_t<_Proj&, _It> operator*() const; // not defined
0040   };
0041 };
0042 
0043 // Note that we implement std::projected in a way that satisfies P2538R1 even in standard
0044 // modes before C++26 to avoid breaking the ABI between standard modes (even though ABI
0045 // breaks with std::projected are expected to have essentially no impact).
0046 template <indirectly_readable _It, indirectly_regular_unary_invocable<_It> _Proj>
0047 using projected = typename __projected_impl<_It, _Proj>::__type;
0048 
0049 #endif // _LIBCPP_STD_VER >= 20
0050 
0051 _LIBCPP_END_NAMESPACE_STD
0052 
0053 #endif // _LIBCPP___CXX03___ITERATOR_PROJECTED_H