I have a problem with the syntax needed to initialize a static member in a class template. Here is the code (I tried to reduce it as much as I could):
template <typename T> struct A { template <typename T1> struct B { static T1 b; }; B<T> b; typedef B<T> BT; T val() { return bb; } }; template <typename T> T A<T>::BT::b; struct D { D() : d(0) {} int d; }; int main() { A<D> a; return a.val().d; }
With g++ , I get the message:
error: too few template-parameter-lists
Any ideas on initializing b?
Please note that I would like to keep typedef as in my real code, B is more complicated than that.
source share