title: How can i put function with different parameters into map in c++?
body: <p>I need to design a map, which save all function i may use in the futures.</p>
  <p>all the functions will have <code>double</code> as its return value.</p>
  <p>and all function share a common parameters <code>const std::vector&lt;float&gt;&amp;</code></p>
  <p>so i define the map as:</p>
  <pre><code>typedef std::function&lt;double(const std::vector&lt;float&gt;&amp;)&gt; func;
  std::unordered_map&lt;std::string, func&gt; f_map;
  </code></pre>
  <p>for example. if i have a function looks like:</p>
  <pre><code>double func1(const std::vector&lt;float&gt;&amp; v) {
    return 0.; // just a demo
  }
  </code></pre>
  <p>i can put it into map like this:</p>
  <pre><code>f_map.emplace(&quot;2015&quot;, static_cast&lt;double(*)(const std::vector&lt;float&gt;&amp;)&gt;(func1));
  </code></pre>
  <p>it's ok since i tested it.</p>
  <p>but the problem is:</p>
  <p>i also have some function like this:</p>
  <pre><code>double func2(int a, const std::vector&lt;float&gt;&amp; v) {
    return 0.; // just for demo
  }
  </code></pre>
  <p>how can i input this kind of function in my map?</p>
  <p>std::bind doesnt work if i do like this:</p>
  <pre><code>f_map.emplace(&quot;2000&quot;, static_cast&lt;double(*)(const std::vector&lt;float&gt;&amp;)&gt;(std::bind(func2, 1)));
  </code></pre>
  <p>can you help on this?</p>
  <p>and can you give me your advice on how to save function into map better, thanks very much</p>