
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. 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".
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@gmail.com> A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait). -- Yu Suzuki