[libcxx][ranges] Add `indirectly_movable` and `indirectly_movable_storable`.
Differential Revision: https://reviews.llvm.org/D102639
NOKEYCHECK=True
GitOrigin-RevId: 075f2370c7fa5495649d09be8b1a9802b17a7f2b
diff --git a/include/__iterator/concepts.h b/include/__iterator/concepts.h
index a654131..95f6891 100644
--- a/include/__iterator/concepts.h
+++ b/include/__iterator/concepts.h
@@ -167,7 +167,6 @@
{ _VSTD::to_address(__i) } -> same_as<add_pointer_t<iter_reference_t<_Ip>>>;
};
-
template<class _Ip>
concept __has_arrow = input_iterator<_Ip> && (is_pointer_v<_Ip> || requires(_Ip __i) { __i.operator->(); });
@@ -236,6 +235,19 @@
requires (indirectly_readable<_Its> && ...) && invocable<_Fp, iter_reference_t<_Its>...>
using indirect_result_t = invoke_result_t<_Fp, iter_reference_t<_Its>...>;
+template<class _In, class _Out>
+concept indirectly_movable =
+ indirectly_readable<_In> &&
+ indirectly_writable<_Out, iter_rvalue_reference_t<_In>>;
+
+template<class _In, class _Out>
+concept indirectly_movable_storable =
+ indirectly_movable<_In, _Out> &&
+ indirectly_writable<_Out, iter_value_t<_In>> &&
+ movable<iter_value_t<_In>> &&
+ constructible_from<iter_value_t<_In>, iter_rvalue_reference_t<_In>> &&
+ assignable_from<iter_value_t<_In>&, iter_rvalue_reference_t<_In>>;
+
// clang-format on
#endif // !defined(_LIBCPP_HAS_NO_RANGES)
diff --git a/include/iterator b/include/iterator
index 08faf4d..929cc16 100644
--- a/include/iterator
+++ b/include/iterator
@@ -125,6 +125,13 @@
template<weakly_incrementable I, indirectly_regular_unary_invocable<I> Proj>
struct incrementable_traits<projected<I, Proj>>; // since C++20
+// [alg.req.ind.move], concept indirectly_movable
+template<class In, class Out>
+ concept indirectly_movable = see below; // since C++20
+
+template<class In, class Out>
+ concept indirectly_movable_storable = see below; // since C++20
+
template<class Category, class T, class Distance = ptrdiff_t,
class Pointer = T*, class Reference = T&>
struct iterator // deprecated in C++17