Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost][msm] std::vector<MyStateMachine> generate stack overflow
From: Christophe Henry (christophe.j.henry_at_[hidden])
Date: 2011-05-19 15:08:13


>It's not the vector, it's the copy constructor. You can see the same problem with :
>
>
> RealStateMachine sma;
> RealStateMachine smb( sma );
>
>At the moment I'm not sure exactly what makes it a recursive call. Was the generated state machine not thought to be copied, or did I made a mistake?

Yes, a state machine can be copied and no you didn't make any mistake.
I think it's a compiler bug because:
- it works fine with g++ 4.5
- the debugger doesn't even make it to the copy-constructor.

I remember I had in the past problems when inheriting from a state
machine with VC. The only solutions I see is to use a typedef instead
or using aggregation instead of inheritance.
This works:
typedef boost::msm::back::state_machine< StateMachine > RealStateMachine;

Unfortunately, I cannot help on this. Maybe Stephan is aware of this problem?

Christophe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net