[libcxx-commits] [PATCH] D128983: [libcxx][ranges] implement `std::ranges::set_difference`

Konstantin Varlamov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 7 16:59:38 PDT 2022


var-const added inline comments.


================
Comment at: libcxx/include/__algorithm/set_difference.h:68-76
+  auto __ret = std::__set_difference(
+      __first1,
+      __last1,
+      __first2,
+      __last2,
+      __result,
+      __less<typename iterator_traits<_InputIterator1>::value_type,
----------------
philnik wrote:
> Why aren't you returning `std::__set_difference(...).second` here? IIUC explicitly doing the move is either redundant because of implicit move or detrimental because of copy elision.
I think implicit move doesn't apply when returning a member of an object, even if the object itself is a local variable.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128983



More information about the libcxx-commits mailing list