I am trying to overload dereference * in class node_itr. How do I know if the overloaded * operator will be bound to a left operand or a right operand?
I understand that for an in-class overloaded operator, the object itself is underlying. However I don't know how to distinguish the position of binding. Thanks!
template<typename T>
class node_itr
{
public:
// constructor omitted
T& operator*() const {
return data;
}
private:
T data;
};
#include<iostream>
int main()
{
node_itr i;
std::cout<<*i;
std::cout<<i*; //how do I tell if this is also legal?
return 0;
}