[libcxx-commits] [libcxx] [libc++] Optimize std::find if types are integral and have the same signedness (PR #70345)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Dec 21 08:46:30 PST 2023
================
@@ -162,6 +163,39 @@ void test_deque() {
}
}
+template <class T>
+struct TestIntegerPromotions1 {
+ template <class U>
+ TEST_CONSTEXPR_CXX20 void test(T val, U to_find) {
+ bool expect_match = val == to_find;
+ assert(std::find(&val, &val + 1, to_find) == (expect_match ? &val : &val + 1));
+ }
+
+ template <class U>
+ TEST_CONSTEXPR_CXX20 void operator()() {
+ test<U>(0, 0);
----------------
ldionne wrote:
We should test with other values than `0`.
https://github.com/llvm/llvm-project/pull/70345
More information about the libcxx-commits
mailing list