I want to create an inner template class that will be dependent on the outer class.
I’m having trouble defining its static members:
template<typename T1, typename T2>
struct B {
template<typename T3>
struct C {
static T3 m_c;
};
static T1 * pT1;
};
template<typename T1, typename T2>
template<typename T3>
T3 B<T1,T2>::C<T3>::m_c;
template<typename T1, typename T2>
T1 * B<T1,T2>::pT1 = &B<T1,T2>::C<T2>::m_c;
I’m getting:
a.cc:35: error: expected primary-expression before ‘>’ token
a.cc:35: error: ‘::m_c’ has not been declared
How do I define it?
Thanks.
I’m guessing your compiler fails at parsing the
<sign as the opening bracket of template declaration. Try to tell it explicitly that it is a template, not a less-than operator: