This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Vector (string?) growth factor of 1.5 (insted of 2)


Matt Austern wrote:

A detail comes to my mind, though: perhaps, at construction time,
speed matters more and, in the case of the constructor from input
iterators, we should allow for a bigger factor. Later, memory usage
matters more and a smaller factor seem in order (-> as you say, if
the max speed is really needed reserve is always available, then).

Yes. This seems to me to be a really nice suggestion! Make the growth factor inversely proportional to the size of the vector.

I don't think that is a good suggestion. In fact, I don't think it is standard
conforming.

Thanks Matt for your message and for its technical details.


I hasten to point out, however, that what *I* suggested is different and much
more simple, while conforming (I hope so!): simply expand with two different
factors inside the constructor from input iterators and during the following
use of the container. Not a big deal, after all. Just a small idea.


Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]