diff --git a/qsbr.hpp b/qsbr.hpp index 7513972a..137cb6df 100644 --- a/qsbr.hpp +++ b/qsbr.hpp @@ -1239,10 +1239,9 @@ class [[nodiscard]] qsbr_thread : public std::thread { public: using thread::thread; - template , qsbr_thread>>> + template explicit qsbr_thread(Function &&f, Args &&...args) + requires(!std::is_same_v, qsbr_thread>) : std::thread{make_qsbr_thread(std::forward(f), std::forward(args)...)} {} diff --git a/test/db_test_utils.hpp b/test/db_test_utils.hpp index 84e66592..a02f2f82 100644 --- a/test/db_test_utils.hpp +++ b/test/db_test_utils.hpp @@ -12,12 +12,9 @@ // container internal structure layouts and that is Not Good. #include "global.hpp" // IWYU pragma: keep -// IWYU pragma: no_include <__fwd/sstream.h> // IWYU pragma: no_include <__ostream/basic_ostream.h> -// IWYU pragma: no_include +// IWYU pragma: no_include // IWYU pragma: no_include -// IWYU pragma: no_include "gmock/gmock.h" -// IWYU pragma: no_include "gtest/gtest.h" #include #include @@ -31,13 +28,14 @@ #include #include -#include // IWYU pragma: keep +#include #include #include "gtest_utils.hpp" #include "art.hpp" #include "art_common.hpp" +#include "art_internal.hpp" #include "assert.hpp" #include "mutex_art.hpp" #include "node_type.hpp" @@ -90,13 +88,10 @@ void assert_value_eq(const typename Db::get_result &result, if constexpr (std::is_same_v>) { UNODB_DETAIL_ASSERT(result.second.owns_lock()); UNODB_DETAIL_ASSERT(result.first.has_value()); - UNODB_ASSERT_TRUE(std::equal(std::cbegin(*result.first), - std::cend(*result.first), - std::cbegin(expected), std::cend(expected))); + UNODB_ASSERT_TRUE(std::ranges::equal(*result.first, expected)); } else { UNODB_DETAIL_ASSERT(result.has_value()); - UNODB_ASSERT_TRUE(std::equal(std::cbegin(*result), std::cend(*result), - std::cbegin(expected), std::cend(expected))); + UNODB_ASSERT_TRUE(std::ranges::equal(*result, expected)); } } UNODB_DETAIL_RESTORE_MSVC_WARNINGS() @@ -148,6 +143,11 @@ class [[nodiscard]] tree_verifier final { UNODB_DETAIL_DISABLE_MSVC_WARNING(6326) UNODB_DETAIL_DISABLE_MSVC_WARNING(26440) + // Replace std::enable_if_t in the next two methods with + // requires(std::is_same_v) when LLVM 15 is the oldest supported LLVM version. + // Earlier versions give errors of different declarations having identical + // mangled names. + // NOLINTBEGIN(modernize-use-constraints) template std::enable_if_t>, void> do_insert(key_type k, unodb::value_view v) { @@ -160,6 +160,7 @@ class [[nodiscard]] tree_verifier final { const quiescent_state_on_scope_exit qsbr_after_get{}; UNODB_ASSERT_TRUE(test_db.insert(k, v)); } + // NOLINTEND(modernize-use-constraints) UNODB_DETAIL_RESTORE_MSVC_WARNINGS() void do_remove(key_type k, bool bypass_verifier) { @@ -219,6 +220,11 @@ class [[nodiscard]] tree_verifier final { } UNODB_DETAIL_DISABLE_MSVC_WARNING(26440) + // Replace std::enable_if_t in the next two methods with + // requires(std::is_same_v) when LLVM 15 is the oldest supported LLVM version. + // Earlier versions give errors of different declarations having identical + // mangled names. + // NOLINTBEGIN(modernize-use-constraints) template std::enable_if_t>, void> do_try_remove_missing_key(key_type absent_key) { @@ -231,6 +237,7 @@ class [[nodiscard]] tree_verifier final { const quiescent_state_on_scope_exit qsbr_after_get{}; UNODB_ASSERT_FALSE(test_db.remove(absent_key)); } + // NOLINTEND(modernize-use-constraints) UNODB_DETAIL_RESTORE_MSVC_WARNINGS() UNODB_DETAIL_RESTORE_MSVC_WARNINGS() @@ -338,6 +345,11 @@ class [[nodiscard]] tree_verifier final { } } + // Replace std::enable_if_t in the next four methods with + // requires(std::is_same_v) when LLVM 15 is the oldest supported LLVM version. + // Earlier versions give errors of different declarations having identical + // mangled names. + // NOLINTBEGIN(modernize-use-constraints) template std::enable_if_t>, void> remove( key_type k, bool bypass_verifier = false) { @@ -363,6 +375,7 @@ class [[nodiscard]] tree_verifier final { const quiescent_state_on_scope_exit qsbr_after_get{}; std::ignore = test_db.remove(k); } + // NOLINTEND(modernize-use-constraints) UNODB_DETAIL_DISABLE_MSVC_WARNING(6326) void attempt_remove_missing_keys( @@ -385,6 +398,11 @@ class [[nodiscard]] tree_verifier final { } UNODB_DETAIL_RESTORE_MSVC_WARNINGS() + // Replace std::enable_if_t in the next two methods with + // requires(std::is_same_v) when LLVM 15 is the oldest supported LLVM version. + // Earlier versions give errors of different declarations having identical + // mangled names. + // NOLINTBEGIN(modernize-use-constraints) template std::enable_if_t>, void> try_get( key_type k) const noexcept(noexcept(this->test_db.get(k))) { @@ -397,6 +415,7 @@ class [[nodiscard]] tree_verifier final { const quiescent_state_on_scope_exit qsbr_after_get{}; std::ignore = test_db.get(k); } + // NOLINTEND(modernize-use-constraints) UNODB_DETAIL_DISABLE_MSVC_WARNING(26445) void check_present_values() const { @@ -478,6 +497,9 @@ class [[nodiscard]] tree_verifier final { [[nodiscard, gnu::pure]] constexpr Db &get_db() noexcept { return test_db; } + tree_verifier(const tree_verifier &) = delete; + tree_verifier &operator=(const tree_verifier &) = delete; + private: // Custom comparator is required for key_view. struct comparator {