From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2008-08-11 13:53:15


David Abrahams wrote:

>>>> - States are not an enum values but classes that may have a common
>>>> virtual base, which allows to have state-specific and shared data in
>>>> the FSM. The events are processed in states.
>>> I'm not sure that isn't overkill. In our implementation you are free to
>>> add any data you like to the FSM and use it in your transition (member)
>>> functions.
>> Your approach doesn't allow to separate state-specific data from the
>> common data.
>
> Yes, but in your approach the common data can't persist across state
> transitions. Is that not a serious limitation?

Why? It does persist as long as the FSM persists. All states and their
base classes are constructed and destroyed with the FSM and never in the
middle.