To illustrate, let's say I have a custom container, than using STL std::vector internally. If I typedef std::vector<char*>::iterator before my_container::iterator , then dereferencing the iterator will return a char* . However, my custom container should hide its internal functions, i.e. I want the dereference to return a char .
How can I do that?
class my_container { public: typedef std::vector<char*> vector; private: vector vec_; };
UPDATE: char* is an example. This does not mean the string C; the example will be more clear with int .
Also, I would like to use std::forward_iterator_tag and std::iterator as this seems more standard / current.
source share