
16 Oct
2012
16 Oct
'12
10:47 p.m.
On Tue, Oct 16, 2012 at 10:02 PM, Ion Gaztañaga <igaztanaga@gmail.com>wrote:
If you reserve, then stable vector will call the allocator several times to reserve memory and fill the internal pool. That memory is probably contiguous (it depends on the allocator).
Actually, for a reason I don't understand, using resize instead of reserve makes even better results both in progressive (one by one) creation of elements and going through all the elements (using optional as element allow me to create optional objects without creating the object they wrap), at least in my tests, that I need to check again. Joel Lamotte