Boost logo

Boost Users :

Subject: Re: [Boost-users] [StateChart] Inheriting state
From: Igor R (boost.lists_at_[hidden])
Date: 2010-02-04 07:18:38


> If you continue to have problems, please don't hesitate to post a repro.

Here it is:

#include <boost/statechart/state_machine.hpp>
#include <boost/statechart/simple_state.hpp>
#include <boost/statechart/event.hpp>
#include <boost/statechart/in_state_reaction.hpp>

namespace sc = boost::statechart;

struct Event1 : sc::event<Event1>
{};

template<class Derived, class Outer>
struct ActiveBase : sc::simple_state<Derived, Outer>
{
  void f(const Event1 &)
  {}
};

struct Active;

struct FSM : sc::state_machine<FSM, Active>
{
};

struct Active : ActiveBase<Active, FSM>
{
  typedef sc::in_state_reaction<Event1, ActiveBase, &ActiveBase::f> reactions;
};

int main()
{
  FSM fsm;
  fsm.initiate();
}

MSVC9.0, WinXP.

1>...\boost\statechart\state_machine.hpp(493) : error C2440: 'return'
: cannot convert from 'FSM' to 'ActiveBase<Derived,Outer> &'
1> with
1> [
1> Derived=Active,
1> Outer=FSM
1> ]


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