title: Map Of functions c++
body: <p>I have made a map of functions. all these functions are void and receive single string parameter.</p>
  
  <p>code:</p>
  
  <pre><code>void f1(string params){...}
  void f2(string params){...}
  void f3(string params){...}
  
  map&lt;string , void*&gt; funcMap;
  
  funcMap["f1"] =(void*)&amp;f1;
  funcMap["f2"] =(void*)&amp;f2;
  funcMap["f3"] =(void*)&amp;f3;
  </code></pre>
  
  <p>how do i call a function?
  I tried the next code, but id doesn't work:</p>
  
  <pre><code>void (*func)(string) =  &amp;funcMap[commandType];
  func(commandParam);
  </code></pre>
  
  <p>I get this error message:</p>
  
  <pre><code>Server.cpp:160:46: error: cannot convert ‘void**’ to ‘void (*)(std::string) {aka void (*)(std::basic_string&lt;char&gt;)}’ in initialization
  </code></pre>