You need to use typename
:
cout << typeid(typename T::value_type).name() << endl;
This has nothing to do with typeid
. This is a general issue whenever you use a member of a class where the specific class you use depends on a template parameter. By default, the compiler assumes that all members of some unknown class T
are not types. You have to explicitly tell it otherwise.