Someone posed a question to me, they have a preexisting project, there is a variable that isnt behaving correctly and is causing memory issues, how can I help.
So I wanted to test a theory of mine where I created a basic templated class with a overloaded = operator to monitor any modification to the object.
template<class T>
class Tracker : public T
{
public:
Tracker() {};
T& operator=(const T& other);
};
template<class T>
inline T& Tracker<T>::operator=(const T& other)
{
std::cout << "Tracked Object Changed: " << std::endl;
T::operator=(other);
return *this;
}
So on my question, is there a way to determine where the overloaded = operator is called from (class/function/line number) to be able to log it to a text document for review later.