lundi 26 juin 2017

Pushing_back value in std::vector without auxiliary variable

I'm wondering if it's possible to push_back a variable into a std::vector without the use of another variable. For quite some time I've been doing this:

int temp;
std::cin >> temp;
std::vector<int> v;
v.push_back(temp);

I was wondering if it was possible to do the same in a singe line:

v.push_back(READING_HERE);

Aucun commentaire:

Enregistrer un commentaire