C++时间函数模板
//测时间 class Timer { private: clock_t _start; clock_t _end; public: Timer() { start(); } void start() { _start = clock(); } double get() { _end = clock(); double usedtime = double(_end - _start) / CLK_TCK; cout << "used time: " << usedtime << " s\n"; return usedtime; } };