Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-06-15 14:08:48


"Thorsten Ottosen" <nesotto_at_[hidden]> writes:

> "David Abrahams" <dave_at_[hidden]> wrote in message
> news:u3brjtxrc.fsf_at_boost-consulting.com...
> | Jonathan Wakely <cow_at_[hidden]> writes:
>
> | > 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's incorrect. For example, if the operations are templated no
> | implicit conversion will take place.
>
> would it be correct to implement the binary operators in my "wrapping"
> iterators
> as function templates.

It would be correct to use iterator_adaptor. Why aren't you doing
that?

> template< class VoidIter, class VoidIter2 >
> inline bool operator==( const iter<VoidIter>& l, const iter<VoidIter2>& r )
> { return l.base() == r.base(); }
>
> ?

Sure, but you might want to use disable_if to prevent overeager
matching. Of course the iterators library will take care of this for
you.

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