Boost logo

Boost :

From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2008-08-12 11:55:12

Phil Endecott wrote:
> Martin Vuille wrote:
>> The formal review for Andrey Semashev's Finite State Machines (FSM)
>> library begins today and will run until the 20th.
>> The documentation (overview and reference) is available online:
> I have a question about the lifetime of the state objects.
> I have the impression that the state objects are created when then FSM
> is created and destroyed when it is destroyed. Is this correct?

That's right.

> Thinking about my own FSM code, implemented ad-hoc, I have variables
> whose lifetime should correspond to the period spent in a particular
> state. (Or, more generally, the period spent in a hierarchical group of
> states.) It looks like I can get this only by using the enter/leave
> hooks and a pointer. Is this correct?

Yes, you can use enter/leave handlers. However, I would consider using
boost::optional in order to avoid dynamic memory allocation.

Boost list run by bdawes at, gregod at, cpdaniel at, john at