V
VB
Hi,
I was attempting to implement partial specialization using VC 2005.
However i cannot get my code to compile .. Can you please help me?
template <typename TYPE1>
class myClass<TYPE1, int>
//C2143: syntax error : missing ';' before '<'
//C2059: syntax error : '<'
{//C2143: syntax error : missing ';' before '{'
//error C2447: '{' : missing function header (old-style formal list?)
private:
TYPE1 xUnspecifiedParameter;
int xSpecifiedParameter;
public:
myClass(TYPE1 xUnspecifiedParameter, int xSpecifiedParameter):
xUnspecifiedParameter(xType1),
xSpecifiedParameter(xInt)
{}
};
if i remove <TYPE1, int> from class myClass<TYPE1, int> the compiler
errors go away but instantiating myclass causes errors ...
myClass<int,int> myInstance(2,3);
the compiler complains
error C2977: 'myClass' : too many template arguments
error C2514: 'myClass' : class has no constructors
I was attempting to implement partial specialization using VC 2005.
However i cannot get my code to compile .. Can you please help me?
template <typename TYPE1>
class myClass<TYPE1, int>
//C2143: syntax error : missing ';' before '<'
//C2059: syntax error : '<'
{//C2143: syntax error : missing ';' before '{'
//error C2447: '{' : missing function header (old-style formal list?)
private:
TYPE1 xUnspecifiedParameter;
int xSpecifiedParameter;
public:
myClass(TYPE1 xUnspecifiedParameter, int xSpecifiedParameter):
xUnspecifiedParameter(xType1),
xSpecifiedParameter(xInt)
{}
};
if i remove <TYPE1, int> from class myClass<TYPE1, int> the compiler
errors go away but instantiating myclass causes errors ...
myClass<int,int> myInstance(2,3);
the compiler complains
error C2977: 'myClass' : too many template arguments
error C2514: 'myClass' : class has no constructors