I would like to write wrapper for STL iterator.
It should only change behavior of some methods…
I see it like smth like this:
template<***>
class custom_iterator : public ***
{
T & iter;
public:
custom_iterator(T & iter) : iter(iter) {}
// for example, behaviour that increments value
T_val operator * () { return (*iter)+1; }
};
How it can be made for all types of iterators? I mean:
- Input Iterator
- Output Iterator
- Forward Iterator
- Bidirectional Iterator
- Random Access Iterator
How it is possible?
Take a look at
boost::transform_iterator. I think that’s what you’re trying to get at.Source code