Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-06-14 20:45:33


"Alexey Bakhvalov" <bakhvalov_at_[hidden]> writes:

> "Thorsten Ottosen" <nesotto_at_[hidden]> wrote in message
> news:d8nb2d$92j$1_at_sea.gmane.org...
>> "Alexey Bakhvalov" <bakhvalov_at_[hidden]> wrote in message
>> news:d8l314$p0h$1_at_sea.gmane.org...
>> | Btw, I get similar error if I try to subtract iterator from
>> const_iterator
>> | (or vice versa).
>> | Example:
>> |
>> | typedef boost::ptr_vector<char> TContainer;
>> | TContainer some_vector;
>> | TContainer::const_iterator it1 = some_vector.begin();
>> | TContainer::iterator it2 = some_vector.begin();
>> | size_t diff = it1 - it2;
>> |
>> | It seems that there is a problem with all binary operators that take
>> | iterators as operands.
>>
>> ah yes. I haven't got time to look in the standard, but must iterator and
>> const_iterator be
>> completely interchangable?
>>
>
> I can't find anything in the standard that would explicitly state this but I
> thought that random iterators should mimic regular pointers in as many ways
> as possible (and language allows such operations on pointers).
> It would be good if someone else could comment on this issue.

If someone would clearly and succinctly spell out the question, I'd be
happy to.

-- 
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