Ray's playground

 

boost::array

boost::array — STL compliant container wrapper for arrays of constant size

 

 1 #include <iostream>
 2 #include <string>
 3 #include <boost/array.hpp>
 4 using namespace std;
 5 using namespace boost;
 6 
 7 int main()
 8 {
 9     array<int4> intArray = {123};
10     for(array<int4>::iterator it = intArray.begin(); it != intArray.end(); it++)
11     {
12         cout << *it << endl;
13     }
14 
15     array<string5> stringArray;
16     stringArray.assign("test");
17     for(array<string5>::reverse_iterator it = stringArray.rbegin(); it != stringArray.rend(); it++)
18     {
19         cout << *it << endl;
20     }
21 
22     int a[6];
23     for(int i=0; i<6; i++)
24     {
25         cout << a[i];
26     }
27 
28     cin.get();
29     return 0;
30 }

 

posted on 2011-04-10 21:19  Ray Z  阅读(318)  评论(0编辑  收藏  举报

导航