boost::array

 

#include <cstdio>
#include <iostream>
#include <sstream>
#include <vector>
#include <boost/array.hpp>

using namespace std;
using namespace boost;
int main()
{
	boost::array<int, 5>barray = { 1,2,3,4,5 };
	
	barray[0] = 10;
	
	barray.at(4) = 20;
	
	int *p = barray.data();//存储数组的指针
	
	for (int i = 0; i < barray.size(); i++)
	{
		std::cout << barray[i] << " " << p[i] << std::endl;
	}

	return EXIT_SUCCESS;
}

  

 

posted @ 2021-03-06 23:59  osbreak  阅读(58)  评论(0编辑  收藏  举报