I just wonder if it is possible to new
and initialize a std::vector
at the same time, something like, do the two things in one line:
std::vector<int>* vec = new std::vector<int>(){3, 4};
instead of, first:
std::vector<int>* vec = new std::vector<int>();
then:
vec->push_back(3);
vec->puch_back(4);
Aucun commentaire:
Enregistrer un commentaire