Original Post
I have this test code that is not working: The problem is that even though callMe works, Calls::callMe does not, I get this compile error
template <int (*function)(int)>
int callMe(void* object, int value)
{
return (*function)(value);
}
template <class type>
class Calls;
template <class result, class type1>
class Calls <result(type1)>
{
public:
template <result (*function)(type1)>
static result callMe(void* object, type1 value)
{
return (*function)(value);
}
};
int yo (int i)
{
return i++;
}
int main(int argc, char* argv[])
{
Calls<int(int)>::callMe<yo>(NULL, 1);
callMe<yo>(NULL, 1);
return 0;
}
error C2440: 'specialization' : cannot convert from 'int (__cdecl *)(int)' to 'result (__cdecl *const )(type1)'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast