Is there any operator that can be overloaded so that an object can be made aware when a reference is assigned to it. For example:
Foo f;
Foo copy;
copy = f; // Calls assignment operator
Foo *pF = &f; // Calls operator& which can be overloaded
Foo copy2(f); // Calls copy constructor explicitly
Foo & refF = f; // Can f be made aware that this happened??
I realize that being able to do this is probably a recipe for some future disaster, but it seems potentially useful for tracing or debugging. (Trying to fend off the inevitable "what are you trying to achieve" responses. I'm not trying to solve any specific problem.)
lhs.operator=(const T& rhs)as explicitly opposed tolhs.operator=(const T rhs)?