このシームはMSVC10のバグですか?enable_if on memberテンプレートのテンプレートテンプレートの機能
#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 ::トン(無効)"。
次のコンパイル:
#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