I’m trying to port a C++ project to iOS. It compiles just fine in QtCreator on Linux and Windows and also on MSVC.
Now on Xcode/GCC, with a certain templated class I get the following error: “error: too few template-parameter-lists”.
The code that causes this error looks something like this:
template <typename TA, typename TB, int Type>
class MyClassImpl
{
public:
MyClassImpl();
virtual int GetType() const
{
return type;
}
};
typedef MyClassImpl<float, int, 12> MyFloatIntClass;
MyFloatIntClass::MyFloatIntClass()
{
...
}
int MyFloatIntClass::GetType() const
{
return 22;
}
I’m guessing that something about the typedef syntax is illegal and GCC is more strict on the standard.
Can anybody tell me what exactly the problem is and how I can fix it?
This is just a guess, but do you need to add template<>?
Since it’s a template specialization, I believe it still needs to be a template.
ex.
EDIT: From modelnine’s answer- turns out it needs the untypedef’d name for the ctor.
EDIT2: The following code works fine for me: