cxx03_test.cc 646 B

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