|
Boost Users : |
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2008-06-09 14:40:01
Jeff Flinn skrev:
> David Abrahams wrote:
>> in 1.35 I'm pretty sure that iterator_range<T>::size() only works when T
>> is a random access iterator, and filtered iterators are by necessity
>> bidirectional. I suggest you use
>>
>> std::distance(r.begin(), r.end())
>>
>> if you're willing to pay for O(N) execution.
>>
>
> Hmm, it looks like that's what iterator_range<T>::size() did in 1.34.1
> while 1.35 returns m_Begin - m_End. Any idea why this was done?
boost::distance(r) could also work.
I did it as part of the general clean-up of the range lib. size() is
expected to be O(1) by users, distance() is not.
-Thorsten
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net