은 여기, 한 종류의 paramenter 한 부울과 템플릿 클래스를 작성하는 코드입니다 오전 :부분 템플릿 전문화의 문제점은 무엇입니까?
template<class T, bool p = true>
class A
{
private:
T* ptr;
public:
A();
};
template<class T>
A<T,true>::A()
{
ptr = 0xbaadf00d;
}
int main()
{
A<int> obj;
A<int, false> o;
return(0);
}
그리고 나는이 컴파일 오류가 점점 오전 :
Error 1 error C3860: template argument list following class template name must list parameters in the order used in template parameter list tst.cpp 15
Error 2 error C2976: 'A<T,p>' : too few template arguments tst.cpp 15
내가 잘못하고있는 중이 야 무엇을? 또는 non-type 매개 변수를 부분적으로 특수화하는 것이 금지 된 이유는 무엇입니까? ...
나는 사물의 종류의 전문화를 어떻게해야하고 그래서Warning 1 warning C4127: conditional expression is constant
: 동시에
내가 if 문에서 부울 매개 변수를 사용하는 경우,이 경고를 받고 있어요
도움이 되었으면 좋겠습니다. :)
미리 감사드립니다 !!!!
고마워요 !!! – Serge