   Problem with templates and function pointers
  I have this test code that is not working: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;}The problem is that even though callMe works, Calls::callMe does not, I get this compile errorerror 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
  Well it compiles with GCC 3.4.2. What compiler are you using. I'm not versed in some of the template syntax your using (I only have a basic knowledge of templates though). So I can't tell if it's standards compliant or if it needs some extension in GCC (I'd guess standard).   ;Quote:Original post by CocalusSo I can't tell if it's standards compliant or if it needs some extension in GCC (I'd guess standard).It would appear that it is standard, as it also compiles fine with GCC 4.0.   