Boost logo

Boost :

From: Pavel Vozenilek (pavel_vozenilek_at_[hidden])
Date: 2006-12-16 08:19:02


"Ion Gaztañaga" wrote:

> std::list::size":
>
One solution may be to provide list::size()
and have the size itself encoded as a signed integer.
If the integer is >= 0 then the size() will return it.

After splice() the number will be set negative.
Only the next size() call will go through the list
and set the correct value again.
For a typical list<> use the size() should
get amortized to O(1).

Alexandrescu had discussed this few years ago
in context of his YASLI library.

/Pavel


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