About std::vector::resize().

Dhruv Matani dhruvbird@gmx.net
Thu Jun 24 17:17:00 GMT 2004


On Mon, 2004-06-21 at 19:12, Paolo Carlini wrote:
> Dhruv Matani wrote:
> 
> >>I see. Honestly, I will be away all the next week and will not be able
> >>to follow in detail your work 'til next week. Anyway, I first, preliminary,
> >>comment: any chances we can begin with the simple improvement sketched by
> >>Carlo? That would apply to builtin types, if I understand well, and 
> >>definitely,
> >>*much* more code around would benefit from it. Seems straightforward, right?
> >>    
> >>
> >Continuing from where we left off last time, I have a patch for the
> >vector that I am currently using.
> >  
> >
> Can't we begin with something really simple, suited only for builtin types?
> The case of vector<vector> > etc., while interesting seems far less common
> and much more tricky to implement correctly.

There is no parch for built-in types. The optimization is applicable
only for those types that are:
1. Heavy (copy construction/assignment is expensive)
2. swap is NOT implemented in terms of assignment.

If use with types other than these, then the vector will become slower.

> 
> Paolo.
-- 
        -Dhruv Matani.
http://www.geocities.com/dhruvbird/

The price of freedom is responsibility, but it's a bargain, because
freedom is priceless. ~ Hugh Downs



More information about the Libstdc++ mailing list