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


     1 //---------------------------------------------------------------------------
     2 
     3 #include <vcl.h>
     4 #pragma hdrstop
     5 
     6 #include "Unit4.h"
     7 #include <boost/progress.hpp>
     8 #include <sstream>
     9 using  namespace std;
    10 //---------------------------------------------------------------------------
    11 #pragma package(smart_init)
    12 #pragma resource "*.dfm"
    13 TForm4 *Form4;
    14 //---------------------------------------------------------------------------
    15 __fastcall TForm4::TForm4(TComponent* Owner)
    16     : TForm(Owner)
    17 {
    18 }
    19 
    20 void test_timer(std::stringstream& ss)
    21 {
    22     ss.clear();
    23     boost::progress_timer t(ss);
    24 
    25     {
    26         //boost::progress_timer t1(ss);
    27         Sleep(1000);
    28         //Form4->Memo1->Lines->Add((AnsiString)"1--"+ss.str().c_str());
    29     }
    30 
    31     {
    32         //boost::progress_timer t2(ss);
    33         //boost::progress_timer t(ss);
    34         Sleep(2001);
    35         //Form4->Memo1->Lines->Add((AnsiString)"2--"+ss.str().c_str());
    36     }
    37 
    38     {
    39         //boost::progress_timer t3(ss);
    40         //boost::progress_timer t(ss);
    41         Sleep(3002);
    42         //Form4->Memo1->Lines->Add((AnsiString)"3--"+ss.str().c_str());
    43     }
    44 }
    45 
    46 
    47 //---------------------------------------------------------------------------
    48 void __fastcall TForm4::Button1Click(TObject *Sender)
    49 {
    50     std::stringstream ss;
    51      test_timer(ss);
    52     this->Memo1->Lines->Add(ss.str().c_str());
    53 }
    54 //---------------------------------------------------------------------------
  • 相关阅读:
    OC
    OC
    OC
    OC
    OC
    Oracle wm_concat()函数
    字符串拼接
    easyui扩展数据表格点击加号拓展
    子tab里面新增tab(top.jQuery)
    combox datagrid重复请求问题
  • 原文地址:https://www.cnblogs.com/kernel0815/p/3337922.html
Copyright © 2020-2023  润新知