Skip to content

Instantly share code, notes, and snippets.

@qrealka
Created May 30, 2018 10:32
Show Gist options
  • Save qrealka/2487aa46f9f8950f49dc46a262030e95 to your computer and use it in GitHub Desktop.
Save qrealka/2487aa46f9f8950f49dc46a262030e95 to your computer and use it in GitHub Desktop.
c++ measure struct
using namespace std::chrono;
struct measure
{
template<typename F, typename ...Args>
static std::chrono::milliseconds::rep ms(F func, Args&&... args)
{
auto start = system_clock::now();
func(std::forward<Args>(args)...);
auto stop = system_clock::now();
return duration_cast<milliseconds>(stop - start).count();
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment