I have the macro:
#define TWO_CMD( c1, c2 ) { const long r1=c1; if ( r1 ) return r1; return c2; }
and using:
long MyClass::SomeFunc( long a )
{
//...
if ( a )
TWO_CMD( Func<int>(a), Func<void>() );
else
TWO_CMD( Func<double>(), Func<std::string>(a) );
//...
}
Func is the template member functions.
But the key requirement is to keep readability of the code!
I guess there is a variant with template member function which have pointer to member functions as arguments:
return two_cmd( Func<int>, a, Func<void> );
But this syntax is not clear.