简体   繁体   English

如何在模板中为类型引入名称别名

[英]How to introduce a name alias for a type in a template

template<typename T>
using Value_type<T> = typename T::value_type;

I get errors: 我收到错误消息:

expected '=' before '<' token 预期在“ <”令牌之前的“ =”

expected type-specifier before '<' token '<'标记之前的预期类型说明符

Like this: 像这样:

template <typename T>
using Value_type = typename T::value_type;

Just like in the declaration of any primary template, the name of the template itself is not punctuated with the template parameter list. 就像在声明任何主模板中一样,模板本身的名称也不用模板参数列表标点。

template<typename T>
using Value_type = typename T::value_type;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM