C++ examples for STL:vector
Initializing Objects with Initializer Lists
#include <iostream> #include <vector> using namespace std; int main()/*from ww w .ja v a2 s . c o m*/ { using MyVector = vector<int>; MyVector vectorA( 1 ); cout << vectorA.size() << " " << vectorA[0] << endl; MyVector vectorB( 1, 10 ); cout << vectorB.size() << " " << vectorB[0] << endl; return 0; }