
16 Dec
2006
16 Dec
'06
1:19 p.m.
"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