Boost logo

Boost Users :

Subject: Re: [Boost-users] [Iterators] How to implement proxy iterators?
From: Oswin Krause (Oswin.Krause_at_[hidden])
Date: 2012-02-24 14:15:39


Thanks for the reply!

> which states that, for a ReadableIterator i, *i must have a type
> convertible to the iterator's value_type. Further, for iterator_facade,
> the
> type of *i is the iterator's reference type. Therefore, reference must be
> convertible to value_type.
> Proxy references are perfectly fine, you just have to ensure they
> interoperate well with (i.e., are convertible to) the iterator's
> value_type.
This sounds good.

So when I exchange my MatrixRow as reference type with

struct MatrixRowProxy:public MatrixRow //lazyness for the example :)
    operator Vector(){
        return Vector(*this);

and keep everything else untouched, like this:

struct MatrixIterator:
public boost::iterator_facade<
//as before

Everything works? That would be really nice!

In this case I am happy and thank you very much for the hint to the
Definition :). This helped me a lot.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at