[C++] Should the complexity of std::list::size() be O(n) or O(1)?

Paolo Carlini pcarlini@suse.de
Thu Nov 24 01:44:00 GMT 2005


Howard Hinnant wrote:

> Here is an extremely biased summary of my personal opinion on the 
> subject.  It includes a just-completed survey of how the boost 
> library is using list::size and the affected variant of list::splice 
> (motivation is to survey actual use cases as opposed to contrived 
> code).  It also includes a proposal for a new list::splice overload 
> that subsumes the functionality of the problem child and yet remains O
> (1).
>
> http://home.twcny.rr.com/hinnant/cpp_extensions/On_list_size.html

Thanks! By the way, I'm very puzzled by the words: "... snap shot of
boost, just after the release of version 1.33, on Nov. 23, 2005". Maybe
", just after the release of version 1.33" should go?

Paolo.



More information about the Libstdc++ mailing list