[libcxx-commits] [PATCH] D102639: [libcxx][ranges] Add `indirectly_­movable` and `indirectly_movable_storable`.

Zoe Carver via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 15 06:11:31 PDT 2021


zoecarver added a comment.

@ldionne sorry, I just realized that I had some comments responding to various suggestions you made that never got submitted. Anyway, that's why I marked a few things as done but didn't actually do them.



================
Comment at: libcxx/test/std/iterators/iterator.requirements/alg.req.ind.move/indirectly_movable.compile.pass.cpp:40-43
+struct MoveOnlyWrapper {
+  using value_type = MoveOnly;
+  MoveOnly& operator*() const;
+};
----------------
ldionne wrote:
> Suggestion:
> 
> ```
> template <class T>
> struct PointerTo {
>   using value_type = T;
>   T& operator*() const;
> };
> ```
> 
> Then use `PointerTo<MoveOnly>` instead of `MoveOnlyWrapper` in the tests below. I find it easier to understand that way, WDYT?
> 
Yes, that is more readable. Thanks :)


================
Comment at: libcxx/test/std/iterators/iterator.requirements/alg.req.ind.move/indirectly_movable_storable.compile.pass.cpp:135
+static_assert( std::indirectly_movable_storable<PointerTo<MoveOnly>, PointerTo<MoveOnly>>);
+static_assert( std::indirectly_movable<PointerToWithValueType<MoveOnly, MoveOnlyConvertible>,
+                                       PointerToWithValueType<MoveOnly, MoveOnlyConvertible>>);
----------------
ldionne wrote:
> Was this one left behind on purpose?
(Just realized I had an un submitted reply to your previous comment about this. Moving to this thread.)

Yes, I'm trying to demonstrate that `indirectly_­writable<Out, iter_rvalue_reference_t<In>>` works but `indirectly_­writable<Out, iter_value_t<In>>` does not. 

I suppose maybe it would be better to just do `static_assert(indirectly_­writable<PointerToWithValueType<MoveOnly, MoveOnlyConvertible>, iter_rvalue_reference_t<PointerToWithValueType<MoveOnly, MoveOnlyConvertible>>>)` instead. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102639/new/

https://reviews.llvm.org/D102639



More information about the libcxx-commits mailing list