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___ALGORITHM_IN_OUT_RESULT_H
11 #define _LIBCPP___ALGORITHM_IN_OUT_RESULT_H
12 
13 #include <__concepts/convertible_to.h>
14 #include <__config>
15 #include <__utility/move.h>
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_RANGES)
24 namespace ranges {
25 
26 template<class _InputIterator, class _OutputIterator>
27 struct in_out_result {
28   [[no_unique_address]] _InputIterator in;
29   [[no_unique_address]] _OutputIterator out;
30 
31   template <class _InputIterator2, class _OutputIterator2>
32     requires convertible_to<const _InputIterator&, _InputIterator2> && convertible_to<const _OutputIterator&,
33                            _OutputIterator2>
34   _LIBCPP_HIDE_FROM_ABI
35   constexpr operator in_out_result<_InputIterator2, _OutputIterator2>() const & {
36     return {in, out};
37   }
38 
39   template <class _InputIterator2, class _OutputIterator2>
40     requires convertible_to<_InputIterator, _InputIterator2> && convertible_to<_OutputIterator, _OutputIterator2>
41   _LIBCPP_HIDE_FROM_ABI
42   constexpr operator in_out_result<_InputIterator2, _OutputIterator2>() && {
43     return {_VSTD::move(in), _VSTD::move(out)};
44   }
45 };
46 
47 } // namespace ranges
48 #endif // !defined(_LIBCPP_HAS_NO_RANGES)
49 
50 _LIBCPP_END_NAMESPACE_STD
51 
52 #endif // _LIBCPP___ALGORITHM_IN_OUT_RESULT_H
53