[libcxx-commits] [PATCH] D128618: [libc++] Implement ranges::remove{, _if}

Hui via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jun 27 10:31:11 PDT 2022


huixie90 added inline comments.


================
Comment at: libcxx/include/__algorithm/ranges_remove_if.h:36
+_LIBCPP_HIDE_FROM_ABI constexpr
+subrange<_Iter> __remove_if_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
+  auto __end = ranges::__find_if_impl(__first, __last, __pred, __proj);
----------------
By having an impl function, you can save 2 moves of `pred` and `proj` of the range overload, at the cost of having 2 extra moves of iterator/sentinel for iterator overload. is it worth it? sometimes moving iterators can be expensive, especially for iterators in the range adaptor (e.g. zip iterator)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128618



More information about the libcxx-commits mailing list