Appending a vector to a vector [duplicate]

Assuming I have 2 standard vectors:

vector<int> a;
vector<int> b;

Let’s also say the both have around 30 elements.

  • How do I add the vector b to the end of vector a?

The dirty way would be iterating through b and adding each element via vector<int>::push_back(), though I wouldn’t like to do that!

4 s
4

Leave a Comment