Boost logo

Boost :

Subject: Re: [boost] [MSM] Interrupt anonymous transitions or blocking process_events?
From: anlmat (anlmat_at_[hidden])
Date: 2011-04-26 15:09:41


Hi Christophe,

<snip>

>
> You can make a circular buffer of, say, boost::function<void()>, this
> allows you to anonymize functors, for example this can be assigned
> into this boost::function:
> template<class Fsm, class Event>
> struct process_some_event
> {
> process_some_event(Fsm* fsm): fsm_(fsm){}
> void operator()()
> {
> fsm_->process_event(Event());
> }
> Fsm* fsm_;
> };
>
> Or as a variant, you can make a boost::function<void(my_fsm&)> with
> the corresponding operator(). Whatever fits better in your case.

Yes, that could be a good solution. I haven't had time to try that way
yet but I will as soon as I can.

This discussion and similar stuff should go into the docs or some
examples file. Perhaps it would help more people? It has certainly been
of great help to me.

Regards,

Mathias


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk