#include #include #include #include #include #include #include const std::size_t N = 1'000'000; template class container : public Container { public: explicit container() : Container(S) {} }; template static void test(benchmark::State &state) { for (auto _ : state) { T t; #if __cplusplus < 202002L std::iota(std::begin(t), std::end(t), 0); benchmark::DoNotOptimize( std::accumulate(std::begin(t), std::end(t), 0)); #else std::ranges::iota(t, 0); benchmark::DoNotOptimize( std::ranges::fold_left(t, 0, std::plus<>())); #endif } state.SetItemsProcessed(state.iterations()); } BENCHMARK(test>); BENCHMARK(test, N>>); BENCHMARK(test, N>>); BENCHMARK_MAIN();