[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / libcxx / include / __iterator / projected.h
blob463d07b0d33c2d0ccaf980d1310bd55f5353a9fb
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 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP___ITERATOR_PROJECTED_H
11 #define _LIBCPP___ITERATOR_PROJECTED_H
13 #include <__config>
14 #include <__iterator/concepts.h>
15 #include <__iterator/incrementable_traits.h> // iter_difference_t
16 #include <__type_traits/remove_cvref.h>
18 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
19 # pragma GCC system_header
20 #endif
22 _LIBCPP_BEGIN_NAMESPACE_STD
24 #if _LIBCPP_STD_VER >= 20
26 template <class _It, class _Proj>
27 struct __projected_impl {
28 struct __type {
29 using value_type = remove_cvref_t<indirect_result_t<_Proj&, _It>>;
30 indirect_result_t<_Proj&, _It> operator*() const; // not defined
34 template <weakly_incrementable _It, class _Proj>
35 struct __projected_impl<_It, _Proj> {
36 struct __type {
37 using value_type = remove_cvref_t<indirect_result_t<_Proj&, _It>>;
38 using difference_type = iter_difference_t<_It>;
39 indirect_result_t<_Proj&, _It> operator*() const; // not defined
43 // Note that we implement std::projected in a way that satisfies P2538R1 even in standard
44 // modes before C++26 to avoid breaking the ABI between standard modes (even though ABI
45 // breaks with std::projected are expected to have essentially no impact).
46 template <indirectly_readable _It, indirectly_regular_unary_invocable<_It> _Proj>
47 using projected = typename __projected_impl<_It, _Proj>::__type;
49 #endif // _LIBCPP_STD_VER >= 20
51 _LIBCPP_END_NAMESPACE_STD
53 #endif // _LIBCPP___ITERATOR_PROJECTED_H