Boost logo

Boost :

From: Bohdan (gejrlaug_at_[hidden])
Date: 2003-06-06 12:36:46


"Andreas Huber" <ah2003_at_[hidden]> wrote in message
news:bboemu$qr1$1_at_main.gmane.org...
> You can find Aleksey's fsm lib here:
>
> http://www.mywikinet.com/mpl/fsm_example_25_jul_02.zip
>
> In my library, you can look for simple_state::react_impl() which is the
> override for the abstract state_base::react_impl(). The implementation is
> quite simple: all reactions are contained in an mpl::list, which is passed
> to a function. The function then calls the front reaction. If the reaction
> returns that there was a match the result is returned. Otherwise, the
> function calls itself again with the front of the list removed. Of course,
> there is a specialisation for an empty list which does nothing.

Exactly what i was looking for. Thanks.

> BTW, this double dispatch variant is only "cool" ;-) for cases where the
> second stage of the double dispatch has to choose from only a few different
> possibilities. That's because the second stage performs a linear search.

Second stage means inner states ?

> In
> contrast to GOF-visitor, which is essentially constant-time, this variant
> becomes slower the more choices it has in the second stage. But it scales
> much better in terms of dependencies.

Does it mean that for some use cases your lib can be event slower than FSM
implementation with acyclic visitor ? IMHO inner states are not too rare thing
in practice ...

regars,
bohdan


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