1 // Copyright 2004-present Facebook. All rights reserved.
2 #ifndef BENCHMARK_IMPL_H_
3 #define BENCHMARK_IMPL_H_
10 void BM_fn_ptr_invoke_impl(int iters, void (*fn)());
11 void BM_std_function_invoke_impl(int iters, const std::function<void()>& fn);
12 void BM_mem_fn_invoke_impl(int iters,
14 void (TestClass::*memfn)());
15 void BM_virtual_fn_invoke_impl(int iters, VirtualClass* vc);
17 // Inlined version of BM_fn_ptr_invoke_impl().
18 // The compiler could potentially even optimize the call to the function
19 // pointer if it is a constexpr.
20 inline void BM_fn_ptr_invoke_inlined_impl(int iters, void (*fn)()) {
21 for (int n = 0; n < iters; ++n) {
26 // Invoke a function object as a template parameter.
27 // This can be used to directly invoke lambda functions
29 void BM_invoke_fn_template_impl(int iters, const T& fn) {
30 for (int n = 0; n < iters; ++n) {
35 #endif // BENCHMARK_IMPL_H_