[英]c++ template struct “using type = struct_name”
template <::size_t... Is>
struct int_pack {
using type = int_pack;
};
using type = int_pack
here ? using type = int_pack
? using type = struct_name
, is there any specific usage ? using type = struct_name
的模式时,是否有任何特定用法? You don't need using type = int_pack
, it's just a shorter way to write int_pack
. 您不需要
using type = int_pack
,这只是编写int_pack
一种较短方法。
type
is usually used in type_traits
for meta programming. type
通常在type_traits
用于元编程。 For example, std::enable_if
defines a name type
if it's template argument is true
. 例如,如果
std::enable_if
的模板参数为true
则定义一个名称type
。 There are more of these helper functions/structures that define a name type
. 这些帮助程序功能/结构中有更多定义名称
type
。 It's just a name that has stuck, like using i
in a for loop index. 它只是一个名字,就像在for循环索引中使用
i
一样。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.