[libc++][ranges] Add ranges::in_out_out_result
Add `ranges::in_out_out_result`
Reviewed By: Quuxplusone, Mordante, #libc
Spies: libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D118634
NOKEYCHECK=True
GitOrigin-RevId: 610979b301c5e90687a8528b6a685bf20cb643b3
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index 7fdf2ff..65fded9 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -28,6 +28,7 @@
__algorithm/half_positive.h
__algorithm/in_in_out_result.h
__algorithm/in_in_result.h
+ __algorithm/in_out_out_result.h
__algorithm/in_out_result.h
__algorithm/includes.h
__algorithm/inplace_merge.h
diff --git a/include/__algorithm/in_out_out_result.h b/include/__algorithm/in_out_out_result.h
new file mode 100644
index 0000000..222d4de
--- /dev/null
+++ b/include/__algorithm/in_out_out_result.h
@@ -0,0 +1,48 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___ALGORITHM_IN_OUT_OUT_RESULT_H
+#define _LIBCPP___ALGORITHM_IN_OUT_OUT_RESULT_H
+
+#include <__concepts/convertible_to.h>
+#include <__config>
+#include <__utility/move.h>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#ifndef _LIBCPP_HAS_NO_CONCEPTS
+
+namespace ranges {
+template <class _I1, class _O1, class _O2>
+struct in_out_out_result {
+ [[no_unique_address]] _I1 in;
+ [[no_unique_address]] _O1 out1;
+ [[no_unique_address]] _O2 out2;
+
+ template <class _II1, class _OO1, class _OO2>
+ requires convertible_to<const _I1&, _II1> && convertible_to<const _O1&, _OO1> && convertible_to<const _O2&, _OO2>
+ _LIBCPP_HIDE_FROM_ABI constexpr
+ operator in_out_out_result<_II1, _OO1, _OO2>() const& {
+ return {in, out1, out2};
+ }
+
+ template <class _II1, class _OO1, class _OO2>
+ requires convertible_to<_I1, _II1> && convertible_to<_O1, _OO1> && convertible_to<_O2, _OO2>
+ _LIBCPP_HIDE_FROM_ABI constexpr
+ operator in_out_out_result<_II1, _OO1, _OO2>() && {
+ return {_VSTD::move(in), _VSTD::move(out1), _VSTD::move(out2)};
+ }
+};
+} // namespace ranges
+
+#endif // _LIBCPP_HAS_NO_CONCEPTS
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___ALGORITHM_IN_OUT_OUT_RESULT_H
diff --git a/include/algorithm b/include/algorithm
index e5f1030..87e4ec9 100644
--- a/include/algorithm
+++ b/include/algorithm
@@ -24,6 +24,9 @@
template <class I1, class I2, class O>
struct in_in_out_result; // since C++20
+
+ template <class I, class O1, class O2>
+ struct in_out_out_result; // since C++20
}
template <class InputIterator, class Predicate>
@@ -701,6 +704,7 @@
#include <__algorithm/half_positive.h>
#include <__algorithm/in_in_out_result.h>
#include <__algorithm/in_in_result.h>
+#include <__algorithm/in_out_out_result.h>
#include <__algorithm/in_out_result.h>
#include <__algorithm/includes.h>
#include <__algorithm/inplace_merge.h>
diff --git a/include/module.modulemap b/include/module.modulemap
index 84abf01..adec0b7 100644
--- a/include/module.modulemap
+++ b/include/module.modulemap
@@ -248,6 +248,7 @@
module half_positive { private header "__algorithm/half_positive.h" }
module in_in_out_result { private header "__algorithm/in_in_out_result.h" }
module in_in_result { private header "__algorithm/in_in_result.h" }
+ module in_out_out_result { private header "__algorithm/in_out_out_result.h" }
module in_out_result { private header "__algorithm/in_out_result.h" }
module includes { private header "__algorithm/includes.h" }
module inplace_merge { private header "__algorithm/inplace_merge.h" }