
John Dlugosz skrev:
Does the initialization form I showed earlier, e.g.
std::vector
newvec= list_of().range(RecVec.begin(),db).range(newdata).range(de,RecVec.end()); know to get the total length first, or will it keep re-allocating storage with each underlying insertion? That is, do I get a performance benifit from manually doing:
std::vector
newvec; newvec.reserve (... add up the sizes of my three ranges ...) newvec += range(RecVec.begin(),db).range(newdata).range(de,RecVec.end()); Hmm, I'm sure the last line would be somewhat different. Anyway, do I need to reserve first, or will it be reasonably smart about that?
list_of() is not particularly fast: it uses a deque to store the elements that are being inserted. If you are into speed, look at ref_list_of/cref_list_of (which is very fast), or wait till the new version arrives with new utilities. HTH -Thorsten