Boost logo

Boost :

Subject: Re: [boost] New library in the Vault: ConstantTimeSize
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2008-10-16 14:15:30


----- Original Message -----
From: "Andrey Semashev" <andrey.semashev_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, October 16, 2008 7:01 PM
Subject: Re: [boost] New library in the Vault: ConstantTimeSize

>
> 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.

This is exactly what the quasi_constant do on my library.

Vicente


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