이 이음새는 MSVC10의 버그일까요?클래스 템플릿의 구성원 템플릿 기능에 대한 enable_if
#include <type_traits>
template<int j>
struct A{
template<int i>
typename std::enable_if<i==j>::type
t(){}
};
int main(){
A<1>().t<1>(); //error C2770
}
오류 C2770 : 잘못된 명시 적 template_or_generic 인수 (들) "enable_if :: A 형 : t (무효)".
다음 컴파일 :
#include <type_traits>
template<class j>
struct A{
template<class i>
typename std::enable_if<std::is_same<i,j>::value>::type
t(){}
};
template<unsigned int j>
struct B{
template<unsigned int i>
typename std::enable_if<i==j>::type
t(){}
};
int main(){
A<int>().t<int>();
B<1>().t<1>();
}
g ++ 및 clang ++에서 작동합니다. '#include'와'std :: enable_if'를 사용 했습니까? –
kennytm
예 .......... 12 –
무엇이 오류입니까? 게시물 "작동하지 않는". "일하지 않는다"는 것은 무엇을 의미합니까? 컴파일되지 않습니까, 아니면 뭐죠? – Nawaz