xref: /freebsd/contrib/llvm-project/libcxx/include/__iterator/projected.h (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
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 //===----------------------------------------------------------------------===//
9 
10 #ifndef _LIBCPP___ITERATOR_PROJECTED_H
11 #define _LIBCPP___ITERATOR_PROJECTED_H
12 
13 #include <__config>
14 #include <__iterator/concepts.h>
15 #include <__iterator/incrementable_traits.h>
16 #include <__type_traits/remove_cvref.h>
17 
18 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
19 #  pragma GCC system_header
20 #endif
21 
22 _LIBCPP_BEGIN_NAMESPACE_STD
23 
24 #if _LIBCPP_STD_VER >= 20
25 
26 template<indirectly_readable _It, indirectly_regular_unary_invocable<_It> _Proj>
27 struct projected {
28   using value_type = remove_cvref_t<indirect_result_t<_Proj&, _It>>;
29   indirect_result_t<_Proj&, _It> operator*() const; // not defined
30 };
31 
32 template<weakly_incrementable _It, class _Proj>
33 struct incrementable_traits<projected<_It, _Proj>> {
34   using difference_type = iter_difference_t<_It>;
35 };
36 
37 #endif // _LIBCPP_STD_VER >= 20
38 
39 _LIBCPP_END_NAMESPACE_STD
40 
41 #endif // _LIBCPP___ITERATOR_PROJECTED_H
42