Progress库继承timer库,在构造时开始计时,析构时结束计时并输出时间.
#include<boost/progress.hpp> #include<Windows.h> int main() { boost::progress_timer t; //构造计时器t. Sleep(1000); t.~progress_timer(); //析构输出时间. system("pause"); return 0; }
输出: