[libcxx-commits] [PATCH] D104760: [libcxx][NFC] removes `swap`'s dependency on `swap_ranges`

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 22 20:39:54 PDT 2021


Quuxplusone accepted this revision as: Quuxplusone.
Quuxplusone added a comment.

I initially expected the call to `swap`, from within a template named `swap`, to be problematic... but https://godbolt.org/z/hxYaob3eT demonstrates that name lookup seems to be doing the right thing. So, this LGTM, mod two nits!



================
Comment at: libcxx/include/type_traits:4193-4196
 template <class _ForwardIterator1, class _ForwardIterator2>
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
 _ForwardIterator2
 swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2);
----------------
If what you're doing below works (I //think// it does), then you should remove lines 4192-4196 because the forward declaration of `swap_ranges` is no longer needed.


================
Comment at: libcxx/test/std/utilities/utility/utility.swap/swap_array.pass.cpp:18
 #include <memory>
+#include <utility>
 
----------------
Style in `libcxx/test/` is generally to put the header-under-test first in the list of includes, even though that is out of alphabetical order. Please leave this file untouched. (Leaving the tests untouched is also a good way to prove that your change is //really// "NFC".)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104760



More information about the libcxx-commits mailing list