[libcxx-commits] [PATCH] D119445: [libc++] Use std::ranges::swap_ranges in swap CPO

Joe Loser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Feb 10 08:33:47 PST 2022


jloser added inline comments.


================
Comment at: libcxx/include/__concepts/swappable.h:80
     {
-      // TODO(cjdb): replace with `ranges::swap_ranges`.
-      for (size_t __i = 0; __i < _Size; ++__i) {
-        (*this)(__t[__i], __u[__i]);
-      }
+      _VSTD::swap_ranges(_VSTD::addressof(__t[0]), _VSTD::addressof(__t[_Size]), _VSTD::addressof(__u[0]));
     }
----------------
ldionne wrote:
> philnik wrote:
> > 
> I think this is what you want?
Oops, yes. Fixed - thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119445



More information about the libcxx-commits mailing list