This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: list<>.size()




On Fri, 31 Mar 2000, Michael Vance wrote:

> Folks,
> 
> Is list<>.size() O(1) for libstdc++ v3?

AFAICT, no.
>  I bring this up because it's
> becoming a portability problem for us--on Windows list<>.size is O(1),
> so developers will oftentimes write loops with repeated tests against
> it. This becomes a speed nightmare when we port these to Linux.
> 
Looking at the STL docs, I don't see size guaranteed to be O(1).
> If is not O(1) in libstdc++ v3, I would like to strongly encourage
> that it become so :).
I don't have the standard in front of me, but if list.size() isn't
guaranteed to be O(1) in complexity, i would strongly encourage your
programs to stop assuming it is.

 > 
> Regards,
> 
> m.

--Dan



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]