#include
struct A
{
bool f( int a ) { std::cout << "int" << std::endl; return true;};
bool f( int a, int b ) { std::cout << "two int" << std::endl; return true;};
bool f( float a ) {std::cout << "float" << std::endl; return true;};
bool f( float a, float b ) {std::cout << "two float" << std::endl; return true;};
};
template <typename T>
struct Type
{
typedef bool (A::*One)(T);
typedef bool (A::*Two)(T, T);
};
template ::One F >
void run(A & a)
{
T tmp = 0;
(a.*F)(tmp);
}
int main(int argc, char ** argv )
{
A a;
run(a);
run(a);
return 0;
}
Problem lies with syntax of typename Type::One F. If I specify the actual method pointer instead of using my typedef from Type it works fine (see here and here). Is there a way to use those typedefs from Type as template arguments?
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)