[libcxx-commits] [PATCH] D142335: [libc++][ranges] Implement `ranges::to`.

Konstantin Varlamov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 6 01:00:09 PDT 2023


var-const added a comment.

In D142335#4228292 <https://reviews.llvm.org/D142335#4228292>, @philnik wrote:

> Could you split this up into multiple patches? This could be a lot easier to review if all the container changes were in separate patches.

I'd rather keep it as a single patch unless you feel very strongly about it.

> Also, is this still WIP? It looks like large parts of the paper are not implemented.

It implements everything except the `insert_range`/`insert_range_after`/etc. member functions (testing is also still WIP). Those are deliberately left for a follow-up (IMO they should have been a separate paper). I'll update the description.



================
Comment at: libcxx/include/__ranges/to.h:196
+  using _DeduceExpr = typename _Deducer<_Container, _Range, _Args...>::type;
+  return to<_DeduceExpr>(std::forward<_Range>(__range), std::forward<_Args>(__args)...);
+}
----------------
ldionne wrote:
> Did you intend to have ADL here?
Thanks for spotting!


================
Comment at: libcxx/test/std/ranges/range.utility/range.utility.conv/to.pass.cpp:159-161
+    for (int i = Capacity - 2; i >= where_index; --i) {
+      buffer_[i + 1] = buffer_[i];
+    }
----------------
ldionne wrote:
> Can we use `std::move` or `std::move_backward` here?
Went with `shift_right`. Thanks!


================
Comment at: libcxx/test/support/from_range_helpers.h:81-105
+template <class T, template <class I, class S, class A> class Func>
+void for_all_iterators_and_allocators() {
+  using Iterators = types::type_list<
+    cpp20_input_iterator<T*>,
+    forward_iterator<T*>,
+    bidirectional_iterator<T*>,
+    random_access_iterator<T*>,
----------------
ldionne wrote:
> 
Thanks! This is way nicer.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142335



More information about the libcxx-commits mailing list