Boost logo

Boost :

From: Jonathan Wakely (cow_at_[hidden])
Date: 2005-06-15 05:14:43


On Wed, Jun 15, 2005 at 10:24:10AM +0200, Thorsten Ottosen wrote:

> "David Abrahams" <dave_at_[hidden]> wrote in message
> news:uk6kws88y.fsf_at_boost-consulting.com...
>
> | If someone would clearly and succinctly spell out the question, I'd be
> | happy to.
>
> should one be able to add, subtract, and compare mutable random access
> iterators with
> random access const_iterators provided they point to the same container?

It's not required for any iterator in general (you can't convert all
output iterators to input iterators, for instance ostream_iterator
cannot be converted to a read-only iterator type).

But the container requirements require that X::iterator be convertible
to X::const_iterator, and then all those operations work by using that
conversion. That is analogous to implicit T* -> const T* conversion.

So yes, for random access iterators it should work (and all other
iterators for containers).

jon

-- 
"With consistency a great soul has simply nothing to do."
	- Ralph Waldo Emerson

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