我用VC编程,可是用VC编译稍微复杂点的模板程序,就会出错。请问我需要特殊的设置还是该选用其它的编译器?
------------------------编译错误信息-------------------------------
1>e:\代码\testtmpl\testtmpl.cpp(1

: error C2975: 'y' : invalid template argument for 'Add', expected compile-time constant expression
1> e:\代码\testtmpl\alg.hpp(4) : see declaration of 'y'
------------------------以下是代码---------------------------------
template<int x, int y>
struct Add{
static int value;
};
template<int x, int y>
struct Multiply{
static int value;
};
template<int x, int y>
int Add<x,y>::value = x + y;
template<int x, int y>
int Multiply<x,y>::value = x * y;
void main()
{
std::cout<<Add<1, int(Multiply<2, 3>::value) >::value<<"\n";
}