Double dereference off of iterator?

Aug 31, 2009 at 8:11pm
Hey, I was just playing around with a deque of class pointers, and I was wondering if there was some cool C++ way of writing the following more easily:

1
2
3
4
5
6
7
for (deque <Foo*> ::const_iterator
     fooey  = foos.begin();
     fooey != foos.end();
   ++fooey)
  {
  (*fooey)->quux();  // Is there some cool way to do double-dereferences?
  }

(I suppose I could just use Boost's for_each...)
Aug 31, 2009 at 8:40pm
How about using boost::ptr_deque?

It's iterators return the elements already dereferenced.
Aug 31, 2009 at 9:19pm
Ooohh, I'll have to check that one out. Thanks!
Topic archived. No new replies allowed.