[英]C++: Is it possible to template a typename?
Suppose I write: 假设我写:
template<typename X>
typename Namespace::Something<X> S;
And then I template a function as follows: 然后我将一个函数模板化如下:
template<typename X>
void my_function(X input){
S<X> y = S<X>(input);
}
Is this possible? 这可能吗? What would be the syntax to do it if it is possible?
如果可能的话,语法是什么?
You can use an alias template declaration : 您可以使用别名模板声明 :
template <typename X>
using S = Namespace::Something<X>;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.