Hi,
How can I use token pasting preprocessor directive? I need to call the right function given the function names in the form of an array.
And then use it something like:Code:#define CallMyFun( p, n ) p->##n ();
string myFuncs[ 3 ] = { string( "Func1" ), string( "Func2" ), string( "Func3" ) };
class CMyClass
{
public:
bool Func1();
bool Func2();
bool Func3();
};
You can see the problem with the above code. How can I resolve the issue?Code:CMyClass theObject;
CallMyFun( &theObject, myFuncs[ 0 ].c_str() );
Thanks
SB
PS: Is there is another way of resolving the issue via function pointers. Note that the functions are not static members.
