c++ - Problems referring to a nested type of type as argument of a class template -
this question has answer here:
i have class template defines type inside it:
#include <boost/array.hpp> template <typename t, int n> class myfunct { public: typedef boost::array<t,n> farray; myfunct(); };
now have class template. thing makes class particular is supposed work types define, inside of them, type called farray
. not ask why please, there reason this.
template <typename f> class myclass { public: myclass() { f::farray = f::farray(); } };
and use this:
int main(int argc, char** argv) { myclass< myfunct<double,10> > m; }
when have situation compiler gets mad telling me double
has no member called farray
. what's happening?
you need use typename
here:
typename f::farray = typename f::array();
Comments
Post a Comment