Andre Poenitz wrote:
> And the real problem is that writing
> 
> getController<ControlCitation>().whoami()
> 
> is too much effort?

Well, not really. But at the moment I have a hieracrchy of derived 
classes that does just this. I thought I'd try and get rid of the 
templatised middle class and was just exploring alternatives.

class ViewBase_ {
protected:
        ControllerBase & controller_;
};

template<typename Controller>
class ViewBase: public ViewBase_ {
        Controller & controller() 
                { return dynamic_cast<Controller &> (controller_); }
};

class ViewCitation : public ViewBase<ControlCitation> {
        void apply () {
                InsetControlParams & params = controller().params();
        }
};


> As getController is not a type but a function, a typedef won't cut
> it....

Sure.

-- 
Angus

Reply via email to