Boost logo

Boost :

From: Andreas Huber (ah2003_at_[hidden])
Date: 2004-09-14 17:32:09


David Abrahams wrote:
> "Andreas Huber" <ah2003_at_[hidden]> writes:
>
>> Alexander Nasonov wrote:
>>>> Andreas Huber wrote:
>>>>> This all looks very nice. Is it possible to use this scheme with
>>>>> polymorphic states, as follows:
>>>>
>>>> See attachment. It is slow but demonstrates the idea and can be
>>>> improved later.
>>
>> Wow! So simple and yet powerful. It naturally supports nested states
>> and polymorphic events. I guess this could quite easily be developed
>> into a fast & lightweight boost::fsm alternative. Cool!
>
> It's very close to the organization of the MPL FSM samples I have
> posted in the past...

Yep, I had noticed that. What I like better about Alexander's approach
is that the transition table is implemented with ordinary C++ what makes
it quite a bit more expressive than the MPL collections you used in your
examples. Don't get me wrong, I personally love MPL, but I've found that
the average programmer is easily scared away with even very simple MPL
constructs.

> only there's no dumb O(N) for_each dispatching
> in my samples: they're O(1).

Unless I'm missing something one could easily modify Alexander's code to
be O(1) too...?

Regards,

Andreas


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