I am interested in timing the execution time of a free function or a member function (template or not). Call TheFunc the function in question, its call being
With variadic template, you may do:
template double Time_function(F&& f, Ts&&...args) { std::clock_t start = std::clock(); std::forward(f)(std::forward(args)...); return static_cast(std::clock() - start) / static_cast(CLOCKS_PER_SEC); }