Template inheritance inner class access problem

I can't believe gcc won't accept the following code... Please tell me if accessing an inner class from a base template is really not possible or am i missing something?

template <class T> class BaseClass
{
public:
    struct MyStruct
    {
        T *data;
    };
};

template <class T> class ChildClass : public BaseClass <T>
{
    public:

    void problem()
    {
        MyStruct ms1; //error: 'MyStruct' was not declared in this scope
        ::MyStruct ms2; //error: '::MyStruct' has not been declared
        BaseClass<T>::MyStruct ms3; //error: expected `;' before 'ms3'
    }
};
9
задан David Rodríguez - dribeas 16 May 2011 в 08:00
поделиться