Can operator= may be not a member?
- by atch
Having construction in a form:
struct Node
{
Node():left_(nullptr), right_(nullptr)
{ }
int id_;
Node* left_;
Node* right_;
};
I would like to enable syntax:
Node parent;
Node child;
parent.right_ = child;
So in order to do so I need:
Node& operator=(Node* left, Node right);
but I'm getting msg that operator= has to be a member fnc; Is there any way to circumvent this restriction?