xref: /freebsd/contrib/llvm-project/libcxx/include/__iterator/projected.h (revision 29fc4075e69fd27de0cded313ac6000165d99f8b)
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_BEGIN_NAMESPACE_STD
22 
23 #if !defined(_LIBCPP_HAS_NO_CONCEPTS)
24 
25 template<indirectly_readable _It, indirectly_regular_unary_invocable<_It> _Proj>
26 struct projected {
27   using value_type = remove_cvref_t<indirect_result_t<_Proj&, _It>>;
28   indirect_result_t<_Proj&, _It> operator*() const; // not defined
29 };
30 
31 template<weakly_incrementable _It, class _Proj>
32 struct incrementable_traits<projected<_It, _Proj>> {
33   using difference_type = iter_difference_t<_It>;
34 };
35 
36 #endif // !defined(_LIBCPP_HAS_NO_CONCEPTS)
37 
38 _LIBCPP_END_NAMESPACE_STD
39 
40 #endif // _LIBCPP___ITERATOR_PROJECTED_H
41