Input Iterator for a shared_ptr
- by Baz
I have an iterator which contains the following functions:
...
T &operator*() { return *_i; }
std::shared_ptr<T> operator->() { return _i; }
private:
std::shared_ptr<T> _i;
...
How do I get a shared pointer to the internally stored _i?
std::shared_ptr<Type> item = ???
Should I do:
MyInterfaceIterator<Type> i;
std::shared_ptr<Type> item = i.operator->();
Or should I rewrite operator*()?