title: Error with std::bind and templated member functions
body: <p>I am currently writing a gameboy emulator for practicing C++. I have gotten to the part where I implement CPU instructions and decided a vector of std::function was a good choice. </p>
  
  <p>Please note: <code>u8</code> is an alias for <code>uint8_t</code>.</p>
  
  <p>In my code, there is a vector of <code>std::function&lt;u8()&gt;</code> with three types of members:</p>
  
  <ol>
  <li>A lambda expression that returns <code>u8</code>.</li>
  <li>Pointer to a member function.</li>
  <li>Pointer to a templated member function.</li>
  </ol>
  
  <p>I tried to use an initalizer list at first, but it didn't work. I later found out that is because I needed a call to <code>std::bind(/*function ptr*/, this);</code> on the pointers, but when calling this on the templated function pointers, I get the following error: <code>no matching function for call to 'bind'</code>. I would like to have an initalizer list, as right now it is a function with successive calls to <code>emplace_back</code>.</p>
  
  <p>Here is the erroring line:</p>
  
  <p><code>instruction_set.emplace_back(bind(&amp;CPU::OPLoadDualRegister8&lt;B, B&gt;, this)); // 0x40 LD B, B</code></p>
  
  <p>One interesting thing is that when <code>B</code> is replaced with a literal (e.g. <code>0x00</code>) it works perfectly. <code>B</code> is a <code>u8</code> and that is what the template accepts.</p>
  
  <p>So:</p>
  
  <ol>
  <li>Is there any way I can do this less convoluted? (e.g. init lists, std::function with member function ptrs, etc.)</li>
  <li>If this is the best way, what do I do about the templated ptrs?</li>
  <li>Would it better if I took the template params as args and used <code>std::bind</code> to resolve them (all params are either <code>u8</code> or <code>u8&amp;</code>.</li>
  <li>Any optimization suggestions?</li>
  </ol>
  
  <p>Thanks, Zach.</p>