This question already has an answer here:
- Concatenating two std::vectors 15 answers
I am trying to append one vector to another vector, both vectors being same in "dimension".
int main()
{
std::vector<int> v1={1,2,3,4,5},v2={10,11,12};
//v1.push_back(v2)?
//v1 and v2 have same dimensions
}
Without creating loops and pushing back individual element, is there any way to achieve similar to this python statements?
v1=[1,2,3,4,5]
v2=[10,11,12]
v1.extend(v2)
print(v1)
gives [1, 2, 3, 4, 5, 10, 11, 12]
Aucun commentaire:
Enregistrer un commentaire