Boost logo

Boost :

From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2007-04-24 13:45:17


Howard Hinnant wrote:
>
> [snip]
>
> I now prefer the semantics of clear(); swap();. This means that move
> assignment is O(N) instead of O(1). Ok Ion, take a deep breath and
> stay with me for just a minute longer. :-)
>
> [snip]
>
> First, for vector<type with trivial destructor>, clear() is O(1) in
> practice (or it should be). And clear() does not dump capacity, so
> the capacity gets reused via the swap. So we only have to worry about
> vector<type with non-trivial destructor>.

Right now I'm thinking about std::list and (unordered_)map/set. clear()
does not sound very lightweight... ¿collateral damage? ;-)

Regards,

Ion


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk