In C++, I need to defined a macro. That macro would take as parameter a \"block\" of code.
Can we safely use several lines of code as parameter of a macro fu
In C++ you should use a functor! ;)
struct ninja
{
void operator()() const
{
int k = AFunction();
k++;
AnotherFunction( k );
}
};
template
void do_something(Functor const& f)
{
f();
}
template
void do_otherthing(Functor const& f)
{
f();
}
int my_function()
{
ninja foo;
do_something(foo);
do_otherthing(foo);
}