diff --git a/benchmarks/hive_bench.cpp b/benchmarks/hive_bench.cpp index 1f800e7..e050609 100644 --- a/benchmarks/hive_bench.cpp +++ b/benchmarks/hive_bench.cpp @@ -13,10 +13,13 @@ #undef PLF_HIVE_P2596 #undef plf +#if __cplusplus >= 202002L #undef PLF_HIVE_H #define plf matt +#undef __cpp_lib_hive #include "../../plf_hive/plf_hive.h" #undef plf +#endif // __cplusplus >= 202002L #include @@ -63,7 +66,7 @@ struct xoshiro256ss { #define N 1000 -#if N < 256 +#if __cplusplus >= 202002L && N < 256 static void BM_PlfStackIssue1_MattSmart(benchmark::State& state) { int fake_input[N] = {}; xoshiro256ss g; diff --git a/test/hive_test.cpp b/test/hive_test.cpp index cca7023..cd5ea71 100644 --- a/test/hive_test.cpp +++ b/test/hive_test.cpp @@ -1990,17 +1990,18 @@ TYPED_TEST(hivet, MoveOnlyInputIterator) auto& operator++() { ++p_; return *this; } void operator++(int) { ++p_; } bool operator==(const MoveOnlyInputIterator& rhs) const { return p_ == rhs.p_; } + bool operator==(const Value *p) const { return p_ == p; } +#if __cplusplus < 202002L bool operator!=(const MoveOnlyInputIterator& rhs) const { return p_ != rhs.p_; } -#if __cpp_lib_ranges >= 201911 - bool operator==(Value *p) const { return p_ == p; } - bool operator!=(Value *p) const { return p_ != p; } #endif }; + static_assert(std::is_move_constructible::value); static_assert(!std::is_copy_constructible::value); #if __cpp_lib_concepts >= 202002 static_assert(std::input_or_output_iterator); static_assert(!std::forward_iterator); + static_assert(std::sentinel_for); #endif Value a[] = { @@ -2678,7 +2679,7 @@ TEST(hive, SortDoesntUseAllocator) try { while (true) (void)mr.allocate(1); } catch (...) { } - ASSERT_THROW(mr.allocate(1), std::bad_alloc); + ASSERT_THROW((void)mr.allocate(1), std::bad_alloc); h.sort(); int expected[] = {1,1,3,4,5}; EXPECT_TRUE(std::equal(h.begin(), h.end(), expected, expected + 5));