I have the following class used with MSVC2013 Update 4:
template <typename T>
class MyFunction;
template<typename R, class... Ts>
class MyFunction < R(Ts...) >
{
public:
using func_type = R(*)(Ts...);
MyFunction(func_type f)
: m_func(f)
{
}
R operator()(Ts ... args)
{
return m_func(args...);
}
private:
func_type m_func;
};
If I use it like so:
MyFunction<int (int)> f1(nullptr);
MyFunction<int __cdecl(int)> f2(nullptr);
MyFunction<int __stdcall(int)> f3(nullptr);
Why does f3 fail to compile? (Considering that __cdecl works!).
error C2079: 'f3' uses undefined class 'MyFunction<int (int)>'
error C2440: 'initializing' : cannot convert from 'nullptr' to 'int'