vector<> can probably never grow to it's maximum size!
Paolo Carlini
pcarlini@suse.de
Wed Oct 20 14:01:00 GMT 2004
Dhruv Matani wrote:
>The part which handles this case is within the
>__mt_alloc::allocate(n,hint,hint_passer) overload.
>
>Look at the case where __n*sizeof(_Tp) > 128. There is a series of try
>catch which use the _M_at_least field of the hint_passer to detect if
>the allocator can if the __n failed, allocate at least _M_at_least
>objects. If so, then it will succeed.
>
>
You never answered my first objection: if, for whatever reason,
::operator new starts
throwing and every time you allocate only 1 position more, the container
doesn't
grow anymore with the speed mandated by the standard. The only way to be
correct
is multiplying the previous size by factor bigger than 1, typically 1.5-2.0.
Also, please, don't send every time a whole patch including
*everything*: you
understand that we are definitely at the general design stage, so many
things and
details have to be sorted out and discussed before something like this
finds its
way in the repository...
And, please, again, let's discuss one issue at a time.
Paolo.
More information about the Libstdc++
mailing list