vendredi 29 juillet 2016

Does std::vector have a { Initial number of elements} constructor?

In cplusplus reference, Perhabs there is not { initial number of elements } constructor. The example is like below.

vector<string> svec { 5 }; 
cout << svec.capacity() << endl; // log is 5

But, there is explicit vector (size_type n); constructor. In this case, this is not { } brace. What happened to this statement ?

Aucun commentaire:

Enregistrer un commentaire