Boost logo

Boost :

From: Marshall Clow (marshall_at_[hidden])
Date: 2003-07-15 19:01:14


"Joe Gottman" <jgottman_at_[hidden]> wrote:
>Suppose I have a vector<Foo *> and I want to use indirect_iterator to create
>an iterator that allows the user to read but not modify the objects pointed
>to by elements of the vector. In other words, I want to do the following:
> typedef /*whatever */ my_iterator;
> my_iterator it(theVector.begin());
> const Foo &foo = *it;
>
> But I want
> *it = Foo();
>to fail. Also, if possible I would like this new type to interact with
> indirect_iterator<vector<Foo *>::iterator>
>in the expected way.
>
> I'm sure this is possible, but the documentation doesn't really say how to
>do it.

is there some reason you can't use const_iterator?

-- 
-- Marshall
Marshall Clow     Idio Software   <mailto:marshall_at_[hidden]>
Hey! Who messed with my anti-paranoia shot?

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