diff --git a/libcxx/include/__concepts/swappable.h b/libcxx/include/__concepts/swappable.h --- a/libcxx/include/__concepts/swappable.h +++ b/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...