title: how to create wrapper around std::bind
body: <p>I have a function object <code>typedef std::function&lt;bool(Event*)&gt; Handler</code>. A member function always gets assigned to this object. So, I am using <code>std::bind</code> to achieve that.</p>
  
  <pre><code>Handler f = std::bind(&amp;LevelSystem::switchLevel, this, std::placeholders::_1);
  f(new Event("test"));
  </code></pre>
  
  <p>This code above works as expected, but I want to wrap the <code>std::bind</code> in a helper function for cleaner code. This is what I have come up with.</p>
  
  <pre><code> template&lt;class Func&gt; inline Handler MemFn(Func &amp;&amp;f) {
       return std::bind(f, this, std::placeholders::_1);
    }
  </code></pre>
  
  <p>And the usage will be:</p>
  
  <pre><code> Handler f = MemFn(&amp;LevelSystem::switchLevel);
  </code></pre>
  
  <p>I am getting an error when using this function:</p>
  
  <pre><code>No viable conversion from
  '__bind&lt;bool(LevelSystem::*&amp;)(Event *), System *,std::__1::placeholders::__ph&lt;1&gt; &amp;&gt;' to
  'Handler' (aka 'function&lt;bool(Event *)&gt;')
  </code></pre>
  
  <p>I do not understand the error.</p>