Eric Fiselier | b08d8b1 | 2016-07-19 23:07:03 +0000 | [diff] [blame] | 1 | |
| 2 | #include <cstddef> |
| 3 | |
| 4 | #include "benchmark/benchmark.h" |
| 5 | |
| 6 | #if __cplusplus >= 201103L |
| 7 | #error C++11 or greater detected. Should be C++03. |
| 8 | #endif |
| 9 | |
| 10 | void BM_empty(benchmark::State& state) { |
| 11 | while (state.KeepRunning()) { |
| 12 | volatile std::size_t x = state.iterations(); |
| 13 | ((void)x); |
| 14 | } |
| 15 | } |
| 16 | BENCHMARK(BM_empty); |
| 17 | |
| 18 | template <class T, class U> |
| 19 | void BM_template2(benchmark::State& state) { |
| 20 | BM_empty(state); |
| 21 | } |
| 22 | BENCHMARK_TEMPLATE2(BM_template2, int, long); |
| 23 | |
| 24 | template <class T> |
| 25 | void BM_template1(benchmark::State& state) { |
| 26 | BM_empty(state); |
| 27 | } |
| 28 | BENCHMARK_TEMPLATE(BM_template1, long); |
| 29 | BENCHMARK_TEMPLATE1(BM_template1, int); |
| 30 | |
| 31 | BENCHMARK_MAIN() |