Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default template parameters arguments in VC++

Does VC++ not support default template parameters arguments? This simple code:

template <typename T=int>
class X
{
};

X x;

gives me an 'error C2955: 'X' : use of class template requires template argument list'. No complaints about the template declaration, however.

What am I missing here? Some compiler switch maybe?

like image 551
sold Avatar asked Jan 24 '23 04:01

sold


1 Answers

I think you still have to specify an empty template list, or use a typedef:

template <typename T=int>
class X
{
};

X<> x;

typedef X<> XX;
XX x;
like image 175
1800 INFORMATION Avatar answered Feb 13 '23 14:02

1800 INFORMATION