Boost logo

Boost :

Subject: Re: [boost] [Review:Algorithms] all.hpp vs std::count
From: Stephan T. Lavavej (stl_at_[hidden])
Date: 2011-10-04 20:17:49


[Dave Abrahams]
> Furthermore, the size() operation on std::list is not (necessarily) O(1).

[STL]
> FDIS 23.2.1 [container.requirements.general] requires a.size() to have constant complexity.
> 23.3.5 [list] doesn't specify any exceptions to this.
> 23.3.4.1 [forwardlist.overview]/2 does: "A forward_list satisfies all of the requirements of a container (Table 96), except that the size() member function is not provided."
> This was changed from C++03, which specified that size() "should have constant complexity".

[Marshall Clow]
> That's fine - if you are talking about an entire container.
> However, for an arbitrary pair of iterators, it is not true.

Of course. list iterators are still bidirectional.

(As a Standard Library maintainer, I am well aware of all_of/any_of/none_of()'s reasons for existing. I simply pounce on claims about the Standard like cats on yarn.)

STL


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