I'm trying to figure out how I can perform an operation at the time in which a function is called, for example:
ExampleClass eco;
eco.DoStuff(); 
At the point of eco.DoStuff(), I'd like to log to a file.
I'm trying to get something with overloaded operators but with no luck?
E.g.
void operator>>(ExampleClass eco, std::function<void(void)> DoStuff) 
{
 //Perform logging into a file
 DoStuff;
}
int main()
{
  ExampleClass eco;
  std::function<void(void)> func_pointer = std::bind(&ExampleClass::DoStuff, &eco, 2);
  eco >> func_pointer; 
}
This works, however I can't use a flexible parameter for DoStuff, as this has to be explicitly set in func_pointer.
Additionally, creating function pointers for every single method in my class isn't an option.
What's the best way of doing this?
 
     
    