I want to remove the last element from vector v
and copy it to variable q
. Is there a more concise way of doing it than this:
vector<int> v{3, 1, 4, 1};
int q = v.back();
v.pop_back();
I want to remove the last element from vector v
and copy it to variable q
. Is there a more concise way of doing it than this:
vector<int> v{3, 1, 4, 1};
int q = v.back();
v.pop_back();