I have started learning about templates in C++ and am wondering if there is a way to say print out all the read and write to a particular variable just like we can do in CMake. For example, CMake has variable_watch()
which is used to log all attempts to read or modify a variable.
So my question is that is there a way to do this in C++. If there is no built-in way(provided by the standard C++), then will it be possible to implement it somehow(if so, how?). I mean, if CMake can have this feature then maybe C++ too. Maybe we can make use of template metaprogramming or something else.