Boost logo

Boost Users :

Subject: [Boost-users] [msm] EUML and State construction
From: Nate Knight (nate.knight_at_[hidden])
Date: 2011-05-03 17:38:13


I'm trying to construct some euml states with data at the time of the state
machine construction. The below boils down what I'm trying to do and
fails to compile. Should I expect this mechanism to work with the euml
 frontend ?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <boost/msm/back/state_machine.hpp>
#include <boost/msm/front/euml/euml.hpp>

namespace msm = boost::msm;
using namespace msm::front::euml;

BOOST_MSM_EUML_EVENT(test_event)

BOOST_MSM_EUML_DECLARE_STATE((),test_state_t)

struct test_state_with_constructor : public test_state_t
{
    test_state_with_constructor() {}
    test_state_with_constructor(int d) : m_d(d) {}
    int m_d;
};

test_state_with_constructor const test_state;

BOOST_MSM_EUML_TRANSITION_TABLE((
    test_state + test_event == test_state
    ), test_table)

BOOST_MSM_EUML_DECLARE_STATE_MACHINE
(( test_table, init_ << test_state ), test_table_)

typedef msm::back::state_machine<test_table_> test_machine_t;

int main()
{
    test_machine_t tm( msm::back::states_ << test_state_with_constructor(1) );
}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
With gcc 4.5 and Boost 1.46.1, I get:

simpletest.cpp: In function 'int main()':
simpletest.cpp:30:75: error: no match for 'operator<<' in
 'boost::msm::back::states_ << test_state_with_constructor(1)'

Thanks
Nate


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