I Have a struct Node which has front and back pointers and now I want to define the operator -> to do the following:
it->front //should return the front of the Node that iterator point to
it->back //should return the back of the Node that iterator point to
struct Iterator {
...
// here I want to redefine this operator ->
std::shared_ptr<Node> operator->front() {
return m_ptr->front;
}
...
}
This is the Node struct:
struct Node {
T value;
std::shared_ptr<Node> front, back;
Node (T data, std::shared_ptr<Node> ptr, std::shared_ptr<Node> ptr2)
: value(data), front(ptr), back(ptr2) {}
};