Boost logo

Boost :

From: Daryle Walker (darylew_at_[hidden])
Date: 2008-08-17 22:23:20


The new hat is in the sandbox SVN. It still under the "hat"
directory, but this time look at what's in the "containers"
subdirectories.

On Aug 15, 2008, at 12:14 PM, Phil Endecott wrote:
> Daryle Walker wrote:
>> I'm going to redo the "hat" project I have in the sandbox. It
>> currently is a brand new container design; I want to change it
>> into an adaptor, like std::stack.
>
>> Hmm, as I was writing this, I thought of an alternative. Maybe I
>> could use a deque,
>
> Or a vector.

Right now, the default is a deque. I didn't want the exponential
capacity growth vector has if reserve isn't used.

>> but swap the found element with the rear one before popping.
>> Then erasure would be cheaper. Would that work?
>
> Yes, that is certainly the right way to do it.

That's the way I did it. However, the Doxygen comments mention that
this will ruin attempts to maintain a sorted container. You would
have to manually resort after each pop.

-- 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT hotmail DOT com

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