Subject: Re: [Boost-users] [StateChart] Accessing machine and state members from within state constructor
From: Andreas Huber (ahd6974-spamboostorgtrap_at_[hidden])
Date: 2012-07-11 16:13:45


Andre Puschmann <andre.puschmann <at> tu-ilmenau.de> writes:
>
> StateBase( my_context ctx ) : base_type( ctx )
> {
> std::cout << "StateBase cst" << std::endl;
> // critical section
> outermost_context().fsmValue++; // access member of FSM
> (outermost context)
> ctx().stateValue++; // access member in direct context
> }

Please try ...

    StateBase( my_context ctx ) : base_type( ctx )
    {
        std::cout << "StateBase cst" << std::endl;
        this->outermost_context().fsmValue++;
        this->template context<Active>().stateValue++;
    }

... and let me know whether that works for you.

Regards,

-- 
Andreas Huber
When replying by private email, please remove the words spam and trap
from the address shown in the header.