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