C++で開発をしておりまして、ひょんなことからエイリアステンプレートの特殊化をしたくなりました。そもそもエイリアステンプレートは特殊化できるのか、できるとしたらどのように書けばよいのかご回答お願いいたします。
c++
1namespace wck{ 2 template<class T> 3 using my_type = T; 4 template<> 5 using my_type<long> = int;//みたいにしたいけどコンパイルできない 6 7 ///////////////代替案/////////////// 8 template<class T> 9 struct my_class_impl{ 10 using type = T; 11 }; 12 template<> 13 struct my_class_impl<long>{ 14 using type = int; 15 }; 16 template<class T> 17 using my_class_t = my_class_impl<T>::type;//こうするしかないのでしょうか 18};
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/03/27 08:28