Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

joining two vectors in c++

// my linkedin : https://www.linkedin.com/in/vaalarivan-prasanna-3a07bb203/
vector<int> AB;
AB.reserve(A.size() + B.size()); // preallocate memory
AB.insert(AB.end(), A.begin(), A.end());
AB.insert(AB.end(), B.begin(), B.end());
//eg : A = {4, 1}, B = {2, 5}
//after the 2 insert operations, AB = {4, 1, 2, 5}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #joining #vectors
ADD COMMENT
Topic
Name
1+1 =