//
// main.cpp
// C++Test14
//
//
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, const char *argv[]) {
int a[1000000];
for (int i = 0; i < 1000000; i++) {
a[i] = i;
}
vector<int> veca(a, a + 1000000);
// 第一种用法:最原始的语法(用下标)
// clock_t start, end;
// start = clock();
// for(int i = 0; i < 1000000; i++) {
//
// }
// cout << endl;
// end = clock();
// cout << end - start << endl;
// 第二种用法:最原始的语法(用迭代器)
// clock_t start, end;
// start = clock();
// for(auto it = veca.begin(); it != veca.end(); it++){
//
// }
// cout << endl;
// end = clock();
// cout << end - start << endl;
// 第三种用法:STL函数
// clock_t start, end;
// start = clock();
// for_each(veca.begin(), veca.end(), [](int item) {
//
// });
// cout << endl;
// end = clock();
// cout << end - start << endl;
// clock_t start, end;
// start = clock();
// 第五种用法:C++11新增加的(VS2012支持)
// for(int item: a) {
//
// }
// cout << endl;
// end = clock();
// cout << end - start << endl;
// clock_t start, end;
// start = clock();
// for(auto item: a) {
//
// }
// cout << endl;
// end = clock();
// cout << end - start << endl;
// clock_t start, end;
// start = clock();
// for(auto item: veca) {
//
// }
// cout << endl;
// end = clock();
// cout << end - start << endl;
return 0;
}