Supposing I have a function (a decorator) that measures the duration of given function:
#include
void measure(void (*f)()) {
time_t tBe
I also would prefer a lambda (and a std::function as parameter for measure), but since you cannot change that, what about this idea:
m() static.measure. You must set this everytime before you call m(). Also, think about thread safetiness.m() you can then use this reference to get to _d. Alternatively, you could even store the value of _d in a static member var to have it available in m(). Depends on what you actually need from MyClass.This approach would allow to measure only one invocation at a time. For parallel execution of multiple measure() calls you could use thread-local-storage for the reference you set in step 2.