[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:36 PST 2022
jloser updated this revision to Diff 407549.
jloser added a comment.
Actually use std::ranges::swap_ranges instead of std::swap_ranges.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119445/new/
https://reviews.llvm.org/D119445
Files:
libcxx/include/__concepts/swappable.h
Index: libcxx/include/__concepts/swappable.h
===================================================================
--- libcxx/include/__concepts/swappable.h
+++ libcxx/include/__concepts/swappable.h
@@ -9,6 +9,7 @@
#ifndef _LIBCPP___CONCEPTS_SWAPPABLE_H
#define _LIBCPP___CONCEPTS_SWAPPABLE_H
+#include <__algorithm/ranges_swap_ranges.h>
#include <__concepts/assignable.h>
#include <__concepts/class_or_enum.h>
#include <__concepts/common_reference_with.h>
@@ -75,10 +76,7 @@
constexpr void operator()(_Tp(& __t)[_Size], _Up(& __u)[_Size]) const
noexcept(noexcept((*this)(*__t, *__u)))
{
- // TODO(cjdb): replace with `ranges::swap_ranges`.
- for (size_t __i = 0; __i < _Size; ++__i) {
- (*this)(__t[__i], __u[__i]);
- }
+ ranges::swap_ranges(__t, __u);
}
// 2.3 Otherwise, if `E1` and `E2` are lvalues of the same type `T` that models...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119445.407549.patch
Type: text/x-patch
Size: 902 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220210/11828ff9/attachment.bin>
More information about the libcxx-commits
mailing list