I'm a C/Python programmer in C++ land, really working with the STL for the first time. In Python, extending a list with another list uses the list's extend
method:
>>> v = [1, 2, 3]
>>> v_prime = [4, 5, 6]
>>> v.extend(v_prime)
>>> print v
[1, 2, 3, 4, 5, 6]
In C++, I'm currently using this algorithmic approach for vector extension:
v.resize(v.size() + v_prime.size());
copy(v_prime.begin(), v_prime.end(), v.rbegin());
I just want to find out if this was the canonical way of doing vector extension or if there is a simpler way that I'm missing.