quick std::vector.assign question
Should I call std::vector::reserve() before std::vector.assign() on a new vector, or does std::vector::assign() also request storage space before assignment?
It depends on what kind of iterators you feed it. If you feed assign() input iterators it'll add elements one at a time. With random access iterators it should know how much it'll be adding and allocate up front.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement