Boost logo

Boost :

From: Neal Becker (ndbecker2_at_[hidden])
Date: 2007-09-25 12:44:08


Thorsten Ottosen wrote:

> Neal Becker skrev:
>> Giovanni Piero Deretta wrote:
>
>>> I think that what Thorsten was saying ist that the whole point of
>>> using operator- is to guarantee that boost::size is *always* O(1).
>>>
>>> With some list implementations size is O(N), so forwarding to .size()
>>> would violate the guarantee. If you really need to know the size but
>>> do not care of the complexity guarantee, you can use boost::distance.
>>>
>> Thank you. I understand that now. But doesn't this conflict with the
>> range
>> documentation? Look at the last statement:
>>
>> size(x): ...
>> std::distance(p.first,p.second) if p is of type std::pair<T>
>> sz if a is an array of size sz
>> end(s) - s if s is a string literal or a Char*
>> boost_range_size(x) if that expression would invoke a function found by
>> ADL t.size() otherwise
>
> The docs might be out of synch. Which docs and which code are you using?
>
> -Thorsten
>

Code is svn trunk.

Docs are http://boost.org/libs/range/doc/boost_range.html, and it looks like
the svn trunk version libs/range/doc/boost_range.html says the same


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