C++ examples for STL:vector
Using Uniform Initialization to Construct a vector
#include <iostream> #include <vector> using namespace std; int main()//from ww w .j av a 2s . com { using MyVector = vector<int>; MyVector vectorA( 1 ); cout << vectorA.size() << " " << vectorA[0] << endl; MyVector vectorB( 1, 10 ); cout << vectorB.size() << " " << vectorB[0] << endl; MyVector vectorC{ 1, 10 }; cout << vectorC.size() << " " << vectorC[0] << endl; return 0; }