I want to execute some function right before the return of another function. The issue is that there are multiple returns and I don’t want to copy-paste my call before each of them. Is there a more elegant way of doing this?
void f()
{
//do something
if ( blabla )
return;
//do something else
return;
//bla bla
}
I want to call g() before the function returns.
1 Answer