Cpp Vector Push Back Another Vector Code Example


Example 1: how to append one vector to another c++


vector a;
vector b;
// Appending the integers of b to the end of a
a.insert(a.end(), b.begin(), b.end());

Example 2: how to append to a vector c++


//vector.push_back is the function. For example, if we want to add
//3 to a vector, it is just vector.push_back(3)
vector vi;
vi.push_back(1); //[1]
vi.push_back(2); //[1,2]

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable