Skip to content

Using event instance with process_event() #487

@ladislas

Description

@ladislas

Expected Behavior

As described in the tutorial section, I'm using event instances to simplify the transition table.

struct start { ... };
auto e_start = sml::event<start>;

struct game_over { ... };
auto e_game_over = sml::event<game_over>;

class StateMachine {
public:
  auto operator()() {
    using namespace sml;
    return make_transition_table(
     *"src_state"_s + e_start = "dst_state"_s,
      "dst_state"_s + e_game_over = X
    );
  }
};

Now, when I try to call sm.process_event() with the instance, it does not work:

sm.process_event(e_start); // not working
sm.process_event(e_start()); // working but is ugly and people will forget to add the ()
sm.process_event(start {}); // working

Actual Behavior

Just calling process_event() with the instance doesn't do anything.

Steps to Reproduce the Problem

n/a

Specifications

  • Version: latest
  • Platform: macOS
  • Subsystem: n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions