title: C++11 Deferred function calling
body: <p>I create event manager for game engine.
  And I have some problem with it.</p>
  
  <p>Now, my programm can do smth like this:</p>
  
  <pre><code>RegCallback(E_EVSYS_MSG::MATHSQRT, &amp;test_it, &amp;test::bar, 10, 100.0);
  RegCallback(E_EVSYS_MSG::MATHSQRT, &amp;SomeCallback, 10.0f, 100);
  
  CallEvent(E_EVSYS_MSG::MATHSQRT);
  </code></pre>
  
  <p>But, it's not right.
  I store function with paramaters in std::bind:</p>
  
  <pre><code>std::function&lt; void() &gt; m_Func;
  m_Func = std::bind(pmfn, ref, std::forward&lt;ARGS&gt;(data)...);
  </code></pre>
  
  <hr>
  
  <p>So... I don't know, how to separate storing function ptr and parameters.</p>
  
  <p>It have to work like this:</p>
  
  <pre><code>RegCallback(E_EVSYS_MSG::MATHSQRT, &amp;test_it, &amp;test::bar);
  RegCallback(E_EVSYS_MSG::MATHSQRT, &amp;SomeCallback);
  
  CallEvent(E_EVSYS_MSG::MATHSQRT, 10, 100.0);
  </code></pre>
  
  <p>How to achieve this??
  std::bind returns templated std::function, and this is very hard to save it in vector.
  Basically, all callbacks difference only in ptr to function(its may be method or order function). And all callbacks have same parameters(but not same data in paramaters).</p>
  
  <p>P.S Full code of test programm: <a href="http://pastebin.com/Rdyy5LGU" rel="nofollow">http://pastebin.com/Rdyy5LGU</a></p>