Boost logo

Boost :

Subject: Re: [boost] [Review:Algorithms] all.hpp vs std::count
From: Marshall Clow (mclow.lists_at_[hidden])
Date: 2011-10-04 20:00:46

On Oct 4, 2011, at 4:42 PM, Stephan T. Lavavej wrote:

> [Dave Abrahams]
>> Furthermore, the size() operation on std::list is not (necessarily) O(1).
> 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.
> [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".

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

-- Marshall

Marshall Clow Idio Software <mailto:mclow.lists_at_[hidden]>

A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
        -- Yu Suzuki

Boost list run by bdawes at, gregod at, cpdaniel at, john at