zoukankan      html  css  js  c++  java
  • 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 //---------------------------------------------------------------------------
  • 相关阅读:
    C,LINUX,数据结构部分
    LINUX应用开发工程师职位(含答案)
    INT32 System_UserKeyFilter(NVTEVT evt, UINT32 paramNum, UINT32 *paramArray)
    屏幕调试
    1.ARM嵌入式体系结构与接口技术(Cortex-A8版)
    NT9666X调试log
    DemoKit编译过程错误
    selenium 代理设置
    pandas 轮询dataframe
    Spring 定时任务
  • 原文地址:https://www.cnblogs.com/kernel0815/p/3337922.html
Copyright © 2011-2022 走看看