It is possible to push_back
vector
elements in one line when it contains pointers:
vector<SomeClass*> v;
v.push_back(new SomeClass(initVar1));
v.push_back(new SomeClass(initVar2));
v.push_back(new SomeClass(initVar3));
Is there a way to do one-line push_back
s like this with non-pointer variables (which are necessarily copies of other variables)?