From e0a080d00ea013446fcd3579760d70236690ebe4 Mon Sep 17 00:00:00 2001 From: Roman Lebedev Date: Wed, 2 Jun 2021 13:28:05 +0300 Subject: [PATCH] BenchmarkFamilies::FindBenchmarks(): correctly use std::vector<>::reserve() It takes the whole total new capacity, not the increase. --- src/benchmark_register.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/benchmark_register.cc b/src/benchmark_register.cc index 1f0dcd1d..ebea2d92 100644 --- a/src/benchmark_register.cc +++ b/src/benchmark_register.cc @@ -150,7 +150,7 @@ bool BenchmarkFamilies::FindBenchmarks( } // reserve in the special case the regex ".", since we know the final // family size. - if (spec == ".") benchmarks->reserve(family_size); + if (spec == ".") benchmarks->reserve(benchmarks->size() + family_size); for (auto const& args : family->args_) { for (int num_threads : *thread_counts) {