boost库-timer

来源:互联网 发布:淘宝老廖沉香 编辑:程序博客网 时间:2024/06/06 01:19
#include <iostream>
#include <boost/timer.hpp>
using namespace boost;
using namespace std;

int main()
{
timer t;
cout << "max timespan:" << t.elapsed_max() /3600 << "h" << endl;
cout << "min timespan:" << t.elapsed_min() << "s" << endl;
cout << "now time elapsed:" << t.elapsed() << "s" << endl;
return 0;

}



#include <boost/progress.hpp>
#include <fstream>
#include <string>
#include <vector>
#include <iterator>


int main()
{
std::vector<std::string> v(100);
std::ofstream fs("test.txt");
boost::progress_display pd(v.size());
std::vector<std::string>::iterator pos;
for(pos=v.begin();pos!=v.end();++pos)
{
fs<<*pos<<std::endl;
++pd;
}
return 0;
}

0 0
原创粉丝点击