title: How to create map<string, class::method> in c++ and be able to search for function and call it?
body: <p>I'm trying to create a map of string and method in C++, but I don't know how to do it. I would like to do something like that (pseudocode):</p>
  
  <pre><code>map&lt;string, method&gt; mapping =
  {
    "sin", Math::sinFunc,
    "cos", Math::cosFunc,
    ...
  };
  
  ...
  
  string &amp;function;
  handler = mapping.find(function);
  int result;
  
  if (handler != NULL)
    result = (int) handler(20);
  </code></pre>
  
  <p>To be honest I don't know is it possible in C++. I would like to have a map of string, method and be able to search for function in my mapping. If given string name of function exists then I would like to call it with given param.</p>