Created
May 30, 2018 10:32
-
-
Save qrealka/2487aa46f9f8950f49dc46a262030e95 to your computer and use it in GitHub Desktop.
c++ measure struct
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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