[libcxx-commits] [PATCH] D80902: [libcxx] adds lexicographical_compare_three_way

Eric Fiselier via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 9 10:58:41 PDT 2020


EricWF added a comment.

How do we implement the "Mandates" requirement specified here <http://eel.is/c++draft/alg.three.way#1>?



================
Comment at: libcxx/include/algorithm:661
 
+#ifndef _LIBCPP_HAS_NO_SPACESHIP_OPERATOR
+#include <compare>
----------------
Please unconditionally include headers.


================
Comment at: libcxx/include/algorithm:5627
+// lexicographical_compare_three_way
+#ifndef _LIBCPP_HAS_NO_SPACESHIP_OPERATOR
+template <class _InputIterator1, class _InputIterator2, class _Compare>
----------------
blank line after after the `#ifdef`.

We should also gate this on the standard dialect, because three way comparison can be enabled as an extension.


================
Comment at: libcxx/test/std/algorithms/alg.sorting/alg.three.way/lexicographical_compare_three_way.pass.cpp:25
+
+TEST_CONSTEXPR bool test_constexpr() {
+  std::array ia{1, 2, 3};
----------------
You don't need to use `TEST_CONSTEXPR` because the test is unsupported in C++03 (where `constexpr` can't be spelled without Clang getting mad).


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

https://reviews.llvm.org/D80902





More information about the libcxx-commits mailing list