title: [Boost::ext].SML: Access SM and dependencies in an action
body: <p>I'm using SML (<a href="https://boost-ext.github.io/sml/" rel="nofollow noreferrer">https://boost-ext.github.io/sml/</a>) v.1.1.3 and I need to access the injected dependencies and the state machine in actions.
  According to the following commit this should already work: <a href="https://github.com/boost-ext/sml/commit/e6d0685993a8a0160dde1610d7f8be4f811c89d0" rel="nofollow noreferrer">https://github.com/boost-ext/sml/commit/e6d0685993a8a0160dde1610d7f8be4f811c89d0</a>
  This commit was the result of this issue:
  <a href="https://github.com/boost-ext/sml/issues/94" rel="nofollow noreferrer">https://github.com/boost-ext/sml/issues/94</a></p>
  <p>With the subsequent example, where I try to access the dependencies and sm in action2, I get a compile error:
  ...
  sml.hpp:1853:18: note:   cannot convert ‘deps’ (type ‘boost::ext::sml::v1_1_3::aux::pool&lt;int, {anonymous}::actions_guards&amp;, {anonymous}::actions_guards&gt;’) to type ‘int&amp;’  1853 |     return object(event, sm, deps, subs);</p>
  <p>Example:</p>
  <pre><code>#include &lt;boost/sml.hpp&gt;
  #include &lt;cassert&gt;
  #include &lt;iostream&gt;
  
  namespace sml = boost::sml;
  
  namespace {
   
  struct e1 {};
  struct e2 {};
  struct e3 {};
  
  auto action2 = [](const auto&amp; event, auto&amp; sm, int&amp; i, std::string&amp; str) {
      assert(42 == i);
      std::cout &lt;&lt; &quot;action2&quot; &lt;&lt; std::endl;
      std::cout &lt;&lt; &quot;sm.n: &quot; &lt;&lt; sm.n &lt;&lt; std::endl;
  };
  
  struct actions_guards {
      using self = actions_guards;
  
      int n = 10;
  
      auto operator()() {
          using namespace sml;
  
          auto action1 = [](auto e) { std::cout &lt;&lt; &quot;action1: &quot; &lt;&lt; typeid(e).name() &lt;&lt; std::endl; };
  
          auto guard1 = [](int i) {
              assert(42 == i);
              std::cout &lt;&lt; &quot;guard2&quot; &lt;&lt; std::endl;
              return false;
          };
  
          return make_transition_table(
              //  Start           Event             Guard                         Action                        Next
              //+-------------+-------------------+---------------------------+-------------------------------+-------------------------------+
                  *&quot;idle&quot;_s   +   event&lt;e1&gt;       [ guard1 ]                  /   action1                     = &quot;s1&quot;_s,
                  &quot;s1&quot;_s      +   event&lt;e2&gt;       [ &amp;self::guard2 ]           /   action2                     = &quot;s2&quot;_s,
                  &quot;s2&quot;_s      +   event&lt;e3&gt;                                                                   = X
          );
      }
  
      bool guard2(int i) const noexcept {
          assert(42 == i);
          std::cout &lt;&lt; &quot;guard3&quot; &lt;&lt; std::endl;
          return true;
      }
  };
  
  }  // namespace
  
  int main( int argc, char* argv[] )
  {
      actions_guards ag{};
      std::string strDep( &quot;127.0.0.1&quot; );
      int intDep = 42;
      sml::sm&lt;actions_guards&gt; sm{ag, intDep, strDep};
      sm.process_event(e1{});
      sm.process_event(e2{});
      sm.process_event(e3{});
  
      assert(sm.is(sml::X));
  
      return 0;
  }
  </code></pre>
  <p>Error:
  ...
  sml.hpp:1340:10:   required from ‘bool boost::ext::sml::v1_1_3::back::sm_impl&lt;  &gt;::process_event(const TEvent&amp;, TDeps&amp;, TSubs&amp;) [with TEvent = {anonymous}::e2; TDeps = boost::ext::sml::v1_1_3::aux::pool&lt;int, {anonymous}::actions_guards&amp;, {anonymous}::actions_guards&gt;; TSubs = boost::ext::sml::v1_1_3::aux::poolboost::ext::sml::v1_1_3::back::sm_impl&lt;boost::ext::sml::v1_1_3::back::sm_policy&lt;{anonymous}::actions_guards &gt; &gt;; TSM = boost::ext::sml::v1_1_3::back::sm_policy&lt;{anonymous}::actions_guards&gt;]’
  /usr/local/oecore-x86_64_tux_dunfell/sysroots/armv5te-angstrom-linux-gnueabi/usr/include/boost/sml.hpp:1660:81:   required from ‘bool boost::ext::sml::v1_1_3::back::sm&lt;  &gt;::process_event(const TEvent&amp;) [with TEvent = {anonymous}::e2; typename boost::ext::sml::v1_1_3::aux::enable_if&lt;boost::ext::sml::v1_1_3::aux::integral_constant&lt;bool, __is_base_of(TEvent, boost::ext::sml::v1_1_3::back::sm::events_ids)&gt;::value, int&gt;::type  = 0; TSM = boost::ext::sml::v1_1_3::back::sm_policy&lt;{anonymous}::actions_guards&gt;]’
  main.cpp:86:23:   required from here
  /usr/local/oecore-x86_64_tux_dunfell/sysroots/armv5te-angstrom-linux-gnueabi/usr/include/boost/sml.hpp:1853:18: error: no match for call to ‘(boost::ext::sml::v1_1_3::aux::zero_wrapper&lt;{anonymous}::&lt;lambda(const auto:3&amp;, auto:4&amp;, int&amp;, std::string&amp;)&gt;, void&gt;) (const {anonymous}::e2&amp;, boost::ext::sml::v1_1_3::back::sm_implboost::ext::sml::v1_1_3::back::sm_policy&lt;{anonymous}::actions_guards &gt;&amp;, boost::ext::sml::v1_1_3::aux::pool&lt;int, {anonymous}::actions_guards&amp;, {anonymous}::actions_guards&gt;&amp;, boost::ext::sml::v1_1_3::aux::poolboost::ext::sml::v1_1_3::back::sm_impl&lt;boost::ext::sml::v1_1_3::back::sm_policy&lt;{anonymous}::actions_guards &gt; &gt;&amp;)’
  1853 |     return object(event, sm, deps, subs);
  |            ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
  main.cpp:37:16: note: candidate: ‘template&lt;class auto:3, class auto:4&gt; {anonymous}::&lt;lambda(const auto:3&amp;, auto:4&amp;, int&amp;, std::string&amp;)&gt;’
  37 | auto action2 = [](const auto&amp; event, auto&amp; sm, int&amp; i, std::string&amp; str) {
  |                ^
  main.cpp:37:16: note:   template argument deduction/substitution failed:
  In file included from main.cpp:20:
  /usr/local/oecore-x86_64_tux_dunfell/sysroots/armv5te-angstrom-linux-gnueabi/usr/include/boost/sml.hpp:1853:18: note:   cannot convert ‘deps’ (type ‘boost::ext::sml::v1_1_3::aux::pool&lt;int, {anonymous}::actions_guards&amp;, {anonymous}::actions_guards&gt;’) to type ‘int&amp;’
  1853 |     return object(event, sm, deps, subs);
  |            ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~</p>