On Mar 12, 3:30 pm, "D. Susman" <derya.sus...@gmail.comwrote:
Say I have a vector v. Is there a way to limit its size
(capacity?) initially so that it does not grow due to
insertions?
Not really. You can probably come up with some way using a user
defined allocator, however. But...
Would setting the capacity as a fixed number do the trick? If
so, what happens when capacity is reached?
That's the real question. If you support insertion, do you want
to limit the capacity, and if so, what do you do when you reach
the limit? (It's easy to limit the capacity artificially, of
course, by checking the size() before inserting. In which case,
you can do whatever you want.)
What problem are you trying to solve?
--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34