progress_display 可以在控制台上显示程序的执行进度,见图1-1
图1-1
example
1
2 /**
3 * Build Success By VC++ 2010
4 *
5 * boost::progress_display
6 *
7 * copyright (C) 2010, lee
8 */
9
10 #include <iostream>
11 #include <string>
12 #include <vector>
13 #include <boost/progress.hpp>
14
15 using namespace std;
16
17 int main()
18 {
19 vector<string> v(100);
20
21 boost::progress_display pd(v.size());
22
23 vector<string>::iterator pos;
24 for (pos = v.begin(); pos != v.end(); ++pos)
25 {
26 ++pd; // 重载的 ++ 操作符,增加计数并输出当前进度。
27 }
28
29 return 0;
30 }
31
2 /**
3 * Build Success By VC++ 2010
4 *
5 * boost::progress_display
6 *
7 * copyright (C) 2010, lee
8 */
9
10 #include <iostream>
11 #include <string>
12 #include <vector>
13 #include <boost/progress.hpp>
14
15 using namespace std;
16
17 int main()
18 {
19 vector<string> v(100);
20
21 boost::progress_display pd(v.size());
22
23 vector<string>::iterator pos;
24 for (pos = v.begin(); pos != v.end(); ++pos)
25 {
26 ++pd; // 重载的 ++ 操作符,增加计数并输出当前进度。
27 }
28
29 return 0;
30 }
31