We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
includes
1 parent a1f193d commit 16ff469Copy full SHA for 16ff469
benchmarks/src/includes.cpp
@@ -7,6 +7,7 @@
7
#include <cstdint>
8
#include <cstdlib>
9
#include <iostream>
10
+#include <limits>
11
#include <random>
12
#include <ranges>
13
#include <type_traits>
@@ -74,9 +75,8 @@ void bm_includes(benchmark::State& state) {
74
75
76
if (!expected_match) {
77
const T v = needle[needle_size / 2];
- const T r = static_cast<T>(static_cast<make_unsigned_t<T>>(v) + 1);
78
+ const T r = v != numeric_limits<T>::max() ? v + 1 : v - 1;
79
ranges::replace(hay, v, r);
- ranges::sort(hay);
80
}
81
82
for (auto _ : state) {
0 commit comments