iterator迭代器输出数组元素
<pre name="code" class="cpp">#include "stdafx.h"
#include<vector>
#include<iostream>
#include<array>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
array<int, 5> ar = {1,2,3,4,5};
array<int,5>::iterator it;
for (it = ar.begin(); it != ar.end(); it++)
{
cout << *it<< ' ';
}
cout << endl;
system("pause");
return 0;
}
结果是:
更多资料在这里:http://www.cplusplus.com/reference/vector/vector/begin/