"primary expression before". token error in g ++

I have this C ++ code to generate a "primary expression before". token 'with the g ++ compiler. It compiles OK with the cl compiler (MSVC).

template<typename T>
class A : public std::auto_ptr<T>
{
    typedef std::auto_ptr<T> Super;
public:
    A() : Super() { }
    A(T* t) : Super(t) { }
    A(AP<T>& o) : Super(o) { }
    operator bool() { return !!Super.get(); } <--- error!
};

What is wrong with this code?

+3
source share
1 answer

Superis a type. If you want to call a base class function, you can do this via this:

this->get();

, this-> , get() - ; , T. . Parashift ++, " , , , - ?"

+8

All Articles