#include <iostream> #include<boost/array.hpp> int main() { boost::array<int, 6> arr = {1,2,3,4,5,6}; boost::array<int, 6> arr2 = {7,8,9,10,11,12}; std::copy(arr.begin(), arr.end(), std::ostream_iterator<int>(std::cout, " ")); std::cout<<std::endl; arr.swap(arr2); for(size_t i=0;i<arr.size();i++) { std::cout<<arr.at(i)<<" "; } std::cout<<std::endl; return 0; }
boost array是一种静态数组,比stl中的vector效率高