Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-03-24 15:25:07


"Eric Niebler" <eric_at_[hidden]> writes:

> David Abrahams wrote:
>> "Thorsten Ottosen" <nesotto_at_[hidden]> writes:
>>
>>> "Eric Niebler" <eric_at_[hidden]> wrote in message
>>> news:4242F9E4.4090500_at_boost-consulting.com...
>>>| Thorsten Ottosen wrote:
>>>
>>>| says, it suggests an association with the iterator_range<> type. But
>>>| also, in my understanding, the Range concept is a bit more inclusive
>>>| than merely "iterator ranges". A std container satisfies the Range
>>>| concept, doesn't it?
>>>
>>>yes.
>> In what sense is a standard container not an iterator range?
>>
>
>
> You snipped the part of my message where I explain that:
>
> <<
> Consider iterator_range_size(). I could have a container that satisfies
> the range concept for which .size() is an O(1) operation, but
> std::distance( .begin(), .end() ) is O(N). What Big-O is suggested by
> "iterator_range_size()" when applied to one of those contaiers?
>>>

I snipped it because it didn't seem to be relevant to my question.

> My point was, there are range operations that are not necessarily
> implemented in terms of lower-level operations on iterators, so the name
> "iterator_range_size()" might be misleading.

Implementation details are and should be irrelevant to naming AFAICT.
The fact is that the container presents a range of iterators in its
interface. I don't see why anyone would assume that the name implies
something about how operations are implemented under-the-covers.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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