Boost logo

Boost :

From: Joe Gottman (jgottman_at_[hidden])
Date: 2003-07-15 18:39:07


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.

Joe Gottman


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