Boost logo

Boost :

Subject: Re: [boost] New library in the Vault: ConstantTimeSize
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2008-10-16 13:01:17


Mathias Gaunard wrote:
> vicente.botet wrote:
>
>> Boost.ConstantTimeSize defines a configurable wrapper to the stl
>> container list providing a size function with constant, linear or
>> quasy_constant complexity.
>
> I think a wrapper is not a good idea, since you cannot provide O(1)
> splice if splice is O(n).

You can cache size value and keep splice O(1), which will give you O(1)
size() up until you call splice. This is much better than having O(n)
size() all the time.


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