xref: /freebsd-src/contrib/llvm-project/libcxx/include/__algorithm/in_fun_result.h (revision b3edf4467982447620505a28fc82e38a414c07dc)
181ad6265SDimitry Andric // -*- C++ -*-
281ad6265SDimitry Andric //===----------------------------------------------------------------------===//
381ad6265SDimitry Andric //
481ad6265SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
581ad6265SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
681ad6265SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
781ad6265SDimitry Andric //
881ad6265SDimitry Andric //===----------------------------------------------------------------------===//
981ad6265SDimitry Andric 
1081ad6265SDimitry Andric #ifndef _LIBCPP___ALGORITHM_IN_FUN_RESULT_H
1181ad6265SDimitry Andric #define _LIBCPP___ALGORITHM_IN_FUN_RESULT_H
1281ad6265SDimitry Andric 
1381ad6265SDimitry Andric #include <__concepts/convertible_to.h>
1481ad6265SDimitry Andric #include <__config>
1581ad6265SDimitry Andric #include <__utility/move.h>
1681ad6265SDimitry Andric 
1781ad6265SDimitry Andric #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1881ad6265SDimitry Andric #  pragma GCC system_header
1981ad6265SDimitry Andric #endif
2081ad6265SDimitry Andric 
21*b3edf446SDimitry Andric _LIBCPP_PUSH_MACROS
22*b3edf446SDimitry Andric #include <__undef_macros>
23*b3edf446SDimitry Andric 
2481ad6265SDimitry Andric _LIBCPP_BEGIN_NAMESPACE_STD
2581ad6265SDimitry Andric 
2606c3fb27SDimitry Andric #if _LIBCPP_STD_VER >= 20
2781ad6265SDimitry Andric 
2881ad6265SDimitry Andric namespace ranges {
2981ad6265SDimitry Andric template <class _InIter1, class _Func1>
3081ad6265SDimitry Andric struct in_fun_result {
3181ad6265SDimitry Andric   _LIBCPP_NO_UNIQUE_ADDRESS _InIter1 in;
3281ad6265SDimitry Andric   _LIBCPP_NO_UNIQUE_ADDRESS _Func1 fun;
3381ad6265SDimitry Andric 
3481ad6265SDimitry Andric   template <class _InIter2, class _Func2>
3581ad6265SDimitry Andric     requires convertible_to<const _InIter1&, _InIter2> && convertible_to<const _Func1&, _Func2>
in_fun_resultin_fun_result3681ad6265SDimitry Andric   _LIBCPP_HIDE_FROM_ABI constexpr operator in_fun_result<_InIter2, _Func2>() const& {
3781ad6265SDimitry Andric     return {in, fun};
3881ad6265SDimitry Andric   }
3981ad6265SDimitry Andric 
4081ad6265SDimitry Andric   template <class _InIter2, class _Func2>
4181ad6265SDimitry Andric     requires convertible_to<_InIter1, _InIter2> && convertible_to<_Func1, _Func2>
in_fun_resultin_fun_result4281ad6265SDimitry Andric   _LIBCPP_HIDE_FROM_ABI constexpr operator in_fun_result<_InIter2, _Func2>() && {
4381ad6265SDimitry Andric     return {std::move(in), std::move(fun)};
4481ad6265SDimitry Andric   }
4581ad6265SDimitry Andric };
4681ad6265SDimitry Andric } // namespace ranges
4781ad6265SDimitry Andric 
4806c3fb27SDimitry Andric #endif // _LIBCPP_STD_VER >= 20
4981ad6265SDimitry Andric 
5081ad6265SDimitry Andric _LIBCPP_END_NAMESPACE_STD
5181ad6265SDimitry Andric 
52*b3edf446SDimitry Andric _LIBCPP_POP_MACROS
53*b3edf446SDimitry Andric 
5481ad6265SDimitry Andric #endif // _LIBCPP___ALGORITHM_IN_FUN_RESULT_H
55