2.boost遍历数组容器

 1 #include <iostream>
 2 #include <string>
 3 #include<boost/array.hpp>//区别
 4 using namespace std;
 5 
 6 void main()
 7 {
 8     boost::array<int, 10> myarray = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
 9     boost::array<int, 10>::iterator ibegin = myarray.begin();
10     boost::array<int, 10>::iterator iend = myarray.end();
11     for (;ibegin!=iend;ibegin++)
12     {
13         cout << *ibegin << endl;
14     }
15     cin.get();
16 }

 

posted @ 2018-03-26 15:49  喵小喵~  阅读(231)  评论(0编辑  收藏  举报