typedef T Type::* syntax

Viewed 405

I need help to understand the following (simplified) code snipped:

template < typename R >
struct Variable
{
    typedef VariableBaseTable< R >  BaseType;
    typedef R BaseType::*            VarType; //!

    template < typename Type >
    R & operator()(Type * obj) const
    {
        return (reinterpret_cast< ObjType >(obj))->*(_variable); //!
    }
    // more stuff follows
}

The two lines I need help understanding are marked with a //! in the end.

I could not understand what the R BaseType::* is defining. In particular, how the ::* syntax works.

In the second marked line, I could not understand the syntax obj->*(_var), I can see that obj is being dereferenced, but what the * is doing there right after it?

1 Answers
Related