title: How to add/initialize members in an SML state or state machine?
body: <p>I designed this state machine using <a href="https://github.com/boost-ext/sml" rel="nofollow noreferrer">boost::sml</a></p>
  <pre><code>struct LooperStateMachine {
      auto operator()() const {
          using namespace sml;
          
          return make_transition_table(
                  *&quot;beggining&quot;_s + event&lt;heel&gt; / onRecordFirstLoop.value() = &quot;recording_first_loop&quot;_s,
                  &quot;recording_first_loop&quot;_s + event&lt;heel&gt;[is_heel_valid] / onRecordLoops.value() = &quot;recording_other_loops_and_playing&quot;_s,
                  &quot;recording_first_loop&quot;_s + event&lt;toe&gt;[is_toe_valid] / onPlayLoops.value() = &quot;playing_loops&quot;_s,
                  &quot;playing_loops&quot;_s + event&lt;toe&gt;[is_toe_valid]/onStopPlayingLoops.value() = &quot;stopped&quot;_s,
                  &quot;playing_loops&quot;_s + event&lt;heel&gt;[is_heel_valid]/onRecordLoops.value() = &quot;recording_other_loops_and_playing&quot;_s,
                  &quot;recording_other_loops_and_playing&quot;_s + event&lt;toe&gt;[is_toe_valid] / onPlayLoops.value() = &quot;playing_loops&quot;_s,
                  &quot;stopped&quot;_s + event&lt;toe&gt;[is_toe_valid] / onClearLoops.value() = &quot;beggining&quot;_s,
                  &quot;stopped&quot;_s + event&lt;heel&gt;[is_heel_valid] / onSaveLoops.value() = &quot;stopped&quot;_s
          );
          
      }
  
      std::optional&lt;std::function&lt;void()&gt;&gt; onClearLoops;
      std::optional&lt;std::function&lt;void()&gt;&gt; onSaveLoops;
      std::optional&lt;std::function&lt;void()&gt;&gt; onPlayLoops;
      std::optional&lt;std::function&lt;void()&gt;&gt; onRecordLoops;
      std::optional&lt;std::function&lt;void()&gt;&gt; onRecordFirstLoop;
      std::optional&lt;std::function&lt;void()&gt;&gt; onStopPlayingLoops;
  };
  </code></pre>
  <p>However, to use it, the <code>sm</code> auto instantiates it:</p>
  <pre><code>int main() {
      using namespace sml;
  
      sm&lt;LooperStateMachine&gt; sm;
      
  </code></pre>
  <p>So I don't get a chance to set my functions.</p>
  <p>How can I set the functions?</p>