title: no viable overloaded '=' for overloaded static member functions
body: <p>I have this simplified code consisting of a class with a static function, which is stored in map:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;functional&gt;
  #include &lt;map&gt;
  
  class A {
  public:
    static void f(const std::string &amp;s) { std::cout &lt;&lt; s; }
  }; 
  
  std::map&lt;std::string, std::function&lt;void(std::string const &amp;)&gt;&gt; fs; 
  
  int main() {
    fs["f"] = &amp;A::f;
    fs["f"]("hello");
  }
  </code></pre>
  
  <p>This prints the expected <em>hello</em>.</p>
  
  <p>The problem occurs if I overload f() with:</p>
  
  <pre><code> static void f(const std::string &amp;s, int c) { while(c--&gt;0) { std::cout &lt;&lt; s; } }
  </code></pre>
  
  <p>This results in the error:</p>
  
  <pre><code> error: no viable overloaded '='
     fs["f"] = &amp;A::f;
     ~~~~~~~ ^ ~~~~~
   /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/functional:2241:7: note: candidate function not viable: no overload of 'f' matching 'const std::function&lt;void (const std::basic_string&lt;char&gt; &amp;)&gt;' for 1st argument
         operator=(const function&amp; __x)
         ^
   /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/functional:2259:7: note: candidate function not viable: no overload of 'f' matching 'std::function&lt;void (const std::basic_string&lt;char&gt; &amp;)&gt;' for 1st argument
         operator=(function&amp;&amp; __x)
         ^
   /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/functional:2273:7: note: candidate function not viable: no overload of 'f' matching 'nullptr_t' for 1st argument
         operator=(nullptr_t)
         ^
   /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/functional:2302:2: note: candidate template ignored: couldn't infer template argument '_Functor'
         operator=(_Functor&amp;&amp; __f)
         ^
   /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/functional:2311:2: note: candidate template ignored: couldn't infer template argument '_Functor'
         operator=(reference_wrapper&lt;_Functor&gt; __f) noexcept
         ^
  </code></pre>
  
  <p>However, calling both functions works:</p>
  
  <pre><code>A::f("hello ");
  A::f("echo ", 3);
  </code></pre>
  
  <p>So, my question are:</p>
  
  <ol>
  <li>Why this code not compiling even though the operator= seems to exist and function if I don't overload f()?</li>
  <li>How can I get it to work without giving both functions different names?</li>
  </ol>