-
Notifications
You must be signed in to change notification settings - Fork 191
Closed
Description
Thanks to fix #94, I can write sm.process_event()
in action.
I implement the following code:
#include <iostream>
#include <boost/sml.hpp>
namespace sml = boost::sml;
struct e1 {};
struct Table {
auto operator()() const noexcept {
using namespace sml;
return make_transition_table(
*"s1"_s + on_entry<sml::initial> / [](const auto& /*ev*/, auto& sm) {
sm.process_event(e1());
std::cout << "code after sm.process_event(e1());" << std::endl;
} = "s2"_s
,"s1"_s + event<e1> / [] { std::cout << "s1::e1 unexpected" << std::endl; }
,"s2"_s + on_entry<_> / [] { std::cout << "s2::entry" << std::endl; }
,"s2"_s + event<e1> / [] { std::cout << "s2::e1" << std::endl; }
);
}
};
int main() {
sml::sm<Table> sm;
}
I got the following output:
s2::e1
code after sm.process_event(e1());
s2::entry
Expected output is
code after sm.process_event(e1());
s2::entry
s2::e1
Here is running demo:
https://wandbox.org/permlink/r4NIXXnS1SvlCpN4 (sml is nightly updated.)
It seems that sm.process_event(e1());
processed immediately. I believe that actual invokeing e1 should defer until state changes to s2.
It might relate to #96.
Metadata
Metadata
Assignees
Labels
No labels