您的位置:首页 > 编程语言 > C语言/C++

c++ boost--------------boost::progress_timer小试。

2013-09-25 00:21 381 查看
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit4.h"
#include <boost/progress.hpp>
#include <sstream>
using  namespace std;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm4 *Form4;
//---------------------------------------------------------------------------
__fastcall TForm4::TForm4(TComponent* Owner)
: TForm(Owner)
{
}

void test_timer(std::stringstream& ss)
{
ss.clear();
boost::progress_timer t(ss);

{
//boost::progress_timer t1(ss);
Sleep(1000);
//Form4->Memo1->Lines->Add((AnsiString)"1--"+ss.str().c_str());
}

{
//boost::progress_timer t2(ss);
//boost::progress_timer t(ss);
Sleep(2001);
//Form4->Memo1->Lines->Add((AnsiString)"2--"+ss.str().c_str());
}

{
//boost::progress_timer t3(ss);
//boost::progress_timer t(ss);
Sleep(3002);
//Form4->Memo1->Lines->Add((AnsiString)"3--"+ss.str().c_str());
}
}

//---------------------------------------------------------------------------
void __fastcall TForm4::Button1Click(TObject *Sender)
{
std::stringstream ss;
test_timer(ss);
this->Memo1->Lines->Add(ss.str().c_str());
}
//---------------------------------------------------------------------------
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: