On Wed, Jul 31, 2002 at 07:39:57PM +0200, Lars Gullik Bjønnes wrote:

> | +   result = (*h.second)(bv, h.first, arg);
> 
> boost::bind
> boost::function
> ??

Ooh, interesting. I've been reading and it looks like we can use member
functions like this :

        actions.add(LFUN_SHIFT_TAB, &InsetTabular::action_shift_tab,
                &Inset::status_default);

class Action {

        void add(kb_action action, boost::function<action::result, Inset *, string 
const & arg);
        ...
}

dispatch(kb_action action, string const & arg) {
        Inset * inset = theLockingInset();

        if (inset) {
                map[action](inset, action);
        } else {
                default_map[action](action);
        }
}

We would probably use a proxy friend of Inset so we don't need massive
headers in complicated classes or something.

I think this deals with Andre's objections (no context hereh, just the
virtual dispatch for action_shift_tab) and it means we can use member
variables in the action handler etc.

Does this sound workable ? How could I use bind instead ?

regards
john

-- 
"The simpler it is, the harder it is." 
        - Tim Van Holder

Reply via email to