简体   繁体   中英

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.

What if it had two?

template <typename T, typename T2> class X {
  public:
     static int st_;
 };

How would I template the static memebr data?

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).

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. The int is the just type of st_ .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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