title: Disambiguate overloaded member function pointer being passed as template parameter
body: <p>I am attempting to recreate the <strong>Observer pattern</strong> where I can perfectly forward parameters to a given member function of the observers.</p>
  
  <p>If I attempt to pass the address of a <strong>member function</strong> which has <strong>multiple overrides</strong>, it cannot deduce the correct member function based on the arguments.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include &lt;algorithm&gt;
  
  template&lt;typename Class&gt;
  struct observer_list
  {
      template&lt;typename Ret, typename... Args, typename... UArgs&gt;
      void call(Ret (Class::*func)(Args...), UArgs&amp;&amp;... args)
      {
          for (auto obj : _observers)
          {
              (obj-&gt;*func)(std::forward&lt;UArgs&gt;(args)...);
          }
      }
      std::vector&lt;Class*&gt; _observers;
  };
  
  struct foo
  {
      void func(const std::string&amp; s)
      {
          std::cout &lt;&lt; this &lt;&lt; ": " &lt;&lt; s &lt;&lt; std::endl;
      }
      void func(const double d)
      {
          std::cout &lt;&lt; this &lt;&lt; ": " &lt;&lt; d &lt;&lt; std::endl;
      }
  };
  
  int main()
  {
      observer_list&lt;foo&gt; l;
      foo f1, f2;
      l._observers = { &amp;f1, &amp;f2 };
  
      l.call(&amp;foo::func, "hello");
      l.call(&amp;foo::func, 0.5);
  
      return 0;
  }
  </code></pre>
  
  <p>This fails to compile with <code>template argument deduction/substitution failed</code>.</p>
  
  <p>Note that I had <code>Args...</code> and <code>UArgs...</code> because I need to be able to pass parameters which are not necessarily the same type asthe type of the function signature, but are convertible to said type.</p>
  
  <p>I was thinking I could use a <code>std::enable_if&lt;std::is_convertible&lt;Args, UArgs&gt;&gt;</code> call to disambiguate, but I don't believe I can do this with a variadic template parameter pack?</p>
  
  <p><strong>How can I get the template argument deduction to work here?</strong></p>