title: How to store methods as function pointers in a map container?
body: <p>I want to be able to call functions based on the data I read from file.
  So for each item type, I want to call the desired reader method.
  I wrote this code, but it does not compile where I want to add function pointers to the map. What is wrong? </p>
  
  <pre><code>#include &lt;vector&gt;
  #include &lt;map&gt;
  #include &lt;iostream&gt;
  class reader
  {
  
    std::map&lt; std::string, void(*)()&gt; functionCallMap; // function pointer
    void readA(){ std::cout &lt;&lt; "reading A\n";};
    void readB(){ std::cout &lt;&lt; "reading B\n";};;
  public:
    reader()
    {
      *functionCallMap["A"] = &amp;reader::readA;*
      *functionCallMap["B"] = &amp;reader::readB;*
    }
  
    void read()
    {
     auto (*f) = functionCallMap["A"];
     (*f)();
    }
  
  
  
  };
  </code></pre>
  
  <p>I am filling the map at Constructor.</p>