Boost logo

Boost :

Subject: [boost] [msm]Event convert at exit point
From: Takatoshi Kondo (kondo_at_[hidden])
Date: 2011-10-10 06:27:01


Hello,

I have a question about Boost.Msm event conversion at exit pseudo state.
(Version 1.47.0)

http://www.boost.org/doc/libs/1_47_0/libs/msm/doc/HTML/ch03s02.html#d0e942

Exit pseudo states

struct event6
{
    event6(){}
    template <class Event>
    event6(Event const&){}
}; //convertible from any event

Above document said that we can convert the event using the template
constructor. This exmaple doesn't access the constructor's parameter.

I want to propagate some value of the event. Event2 is a source event.
And Event3 is a target event like this.(see attached file)

    struct Event2 {
        Event2(int val_):val(val_) {}
        int val;
    };

    struct Event3 {
        Event3(int val_):val(val_) {}
        template <class T> Event3(T const& e):val(e.val) {} // error
        Event3(Event2 const& e):val(e.val) {} // OK
        int val;
    };

    // Transition table
    struct transition_table:mpl::vector<
        // Start Event Next Action Guard
        msmf::Row < SubState1, Event2, Exit, msmf::none, msmf::none >
> {};

    struct Exit :msm::front::exit_pseudo_state<Event3> {};

But compile error occurred. The compiler said Event1 doesn't have a member 'val'.
I'm not sure why Event3's constructor instantiate from Event1. This is the question.
If I define the constructor that has a parameter Event2 instead of template
parameter, compile error doesn't occur.

exit_pt_convert.cpp(attached file) is a source code that reproduces this error.

Thanks,
Takatoshi



Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk