title: specific class in inheritance hierachy as type in boost::signal2 callback
body: <p>I'm using a  boost::signals2::signal inside a gui-class like this:</p>
  
  <pre><code>class GuiElement {
      //...
      typedef boost::signals2::signal&lt;void(GuiElement &amp;)&gt; GuiElementSignal;
      virtual GuiElementSignal &amp;getSignal() { return signal_; };
  }
  </code></pre>
  
  <p>All gui-classes inherit from this class so that callbacks can be registered. An example with a <code>Toggle</code> class:</p>
  
  <pre><code>toggle.getSignal().connect([](lx::GuiElement &amp;el) {
      // cast to access toggle specific functions
      state = static_cast&lt;lx::Toggle &amp;&gt;(el).state();
      cout &lt;&lt; state &lt;&lt; endl;
  });
  </code></pre>
  
  <p>Inside the callback function everytime I have to cast <code>GuiElement</code> to a <code>SpecificClass</code> to access the specific class functions.
  I'd like to avoid this cast and declare the callback signature as: <code>toggle.getSignal().connect([](lx::Toggle &amp;el) {...</code> </p>
  
  <p>Is there a way to realize this with templates with something like <code>typedef boost::signals2::signal&lt;void(T &amp;)&gt; GuiElementSignal</code> where T is replaced with the class?</p>