quick-bench-front-end
quick-bench-front-end copied to clipboard
Allow templated functions in BENCHMARK macro
Because of the ## magic that you use in the BENCKMARK macro, for the example below I had to introduce two temporary variables TestList
and TestDeque
to pass them into the macro:
#include <list>
#include <deque>
template<class Container>
static
void
Test(benchmark::State& state)
{
Container x;
for (auto _ : state) {
x.push_back(i);
x.push_front(i);
x.pop_back();
x.pop_front();
}
}
const auto TestList = Test<std::list<int>>;
const auto TestDeque = Test<std::deque<int>>;
BENCHMARK(TestList);
BENCHMARK(TestDeque);
It would be nice if I could simply write:
BENCHMARK(Test<std::list<int>>);
BENCHMARK(Test<std::deque<int>>);