[英]Static member data of template class with two parameters
http://www.adp-gmbh.ch/cpp/templates/static_members.html makes it clear what I need to do - if the template has a single parameter. 如果模板具有单个参数,则http://www.adp-gmbh.ch/cpp/templates/static_members.html明确说明了我需要执行的操作。
What if it had two? 如果有两个怎么办?
template <typename T, typename T2> class X {
public:
static int st_;
};
How would I template the static memebr data? 我如何模板化静态memebr数据?
template <typename T, typename T2> int, int X<T, T2>::st_;
or 要么
template <typename T, typename T2> int int X<T, T2>::st_;
or what? 要不然是啥?
I think that my problem is knowinng what to do with the two real types (both int here). 我认为我的问题是知道如何处理这两种实类型(此处均为int)。
After templating, how do I declare my static member variable? 模板化后,如何声明我的静态成员变量?
template <typename T, typename T2>
int X<T, T2>::st_;
You don't need two int
-s. 您不需要两个int
-s。 The int
is the just type of st_
. int
是st_
的正义类型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.