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

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 7 17:06:42 PDT 2022


philnik 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,
----------------
var-const wrote:
> 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.
https://godbolt.org/z/q1rj39Tdf looks to me a lot like an implicit move.


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