[libcxx-commits] [libcxx] fce9ca3 - [libc++][test] Pass correct ordering to std::merge

Casey Carter via libcxx-commits libcxx-commits at lists.llvm.org
Mon Oct 19 17:12:53 PDT 2020


Author: Casey Carter
Date: 2020-10-19T17:12:06-07:00
New Revision: fce9ca3c1e3adf9f506cd0e195b7f27b4f8db0c4

URL: https://github.com/llvm/llvm-project/commit/fce9ca3c1e3adf9f506cd0e195b7f27b4f8db0c4
DIFF: https://github.com/llvm/llvm-project/commit/fce9ca3c1e3adf9f506cd0e195b7f27b4f8db0c4.diff

LOG: [libc++][test] Pass correct ordering to std::merge

The predicate passed to `merge` must induce a strict weak ordering on its arguments.

Added: 
    

Modified: 
    libcxx/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp
index 376ffd0d1d59..b15a6ff4e21a 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp
@@ -41,7 +41,7 @@ TEST_CONSTEXPR bool test_constexpr() {
 
   auto it =
       std::merge(std::begin(ia), std::end(ia), std::begin(ib), std::end(ib),
-                 std::begin(ic), [](int a, int b) { return a == b; });
+                 std::begin(ic), std::less<>{});
   assert(std::distance(std::begin(ic), it) == (std::size(ia) + std::size(ib)));
   assert(*it == 0);
   assert(


        


More information about the libcxx-commits mailing list