Container of shared_ptr's but iterate with raw pointers
- by Sean Lynch
I have a class that holds a list containing boost::shared_ptrs to objects of another class.
The class member functions that give access to the elemets in the list return raw pointers. For consistency I'd also like to be able to iterate with raw pointers instead of shared_ptrs. So when I dereference the list iterator, I'd like to get raw pointer, not a shared_ptr.
I assume I need to write a custom iterator for this. Is this correct? If so can someone point me in the right direction - I've never done this before.