Boost logo

Boost :

Subject: Re: [boost] [MSM] Interrupt anonymous transitions or blocking process_events?
From: Christophe Henry (christophe.j.henry_at_[hidden])
Date: 2011-04-28 13:57:15


>> 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.

Actually I plan to do even better and offer a more general library
solution for this. It's one of the big items on my list, and a pretty
high one.

Cheers,

Christophe


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