c++ - How to initialize static field in template class with type of inner class -
i have this
template <class t> class outer { public: class inner; static inner* x; //... class inner { //... }; }; // not working template <class t> outer<t>::inner* outer<t>::x = null;
error says: :16: error: expected constructor, destructor, or type conversion before ‘*’ token
template<class t> class outer { public: class inner; static inner* x; //... class inner { //... }; }; template<class t> typename outer<t>::inner *outer<t>::x = null;
as
typename
,class
, please refer c++ difference of keywords 'typename' , 'class' in templateswhy this, please refer trouble dependent types in templates
Comments
Post a Comment