I'm about to make a part of a program where I merge data stored in different vectors, or arrays depending on how smooth merging the two structures are.
Whats the fastest way of doing it? Allocate a big array, or vector and iterate in content from the parts I'm merging. Or is there some core function that does it better..?
vector<MyStruct> a;
vectot<MyStruct> b;
//fill a and b with stuff
vector<MyStruct> t (a);
t.reserve(a.size()+b.size());
t.insert(t.end(), b.begin(), b.end());