title: map string to function
body: <p>I'm trying to do this but it does not work
  this is my error: </p>
  
  <blockquote>
    <p>must use ‘.<em>’ or ‘-></em>’ to call pointer-to-member function in
    ‘((test*)this)->test::mapping.std::map&lt;_Key, _Tp, _Compare,
    _Alloc>::operator[], void (test::*)(int), std::less >, std::allocator, void (test::*)(int)> > >((<em>(const
    key_type</em>)(&amp; str))) (...)’, e.g. ‘(... ->*
    ((test*)this)->test::mapping.std::map&lt;_Key, _Tp, _Compare,
    _Alloc>::operator[], void (test::*)(int), std::less >, std::allocator, void (test::*)(int)> > >((<em>(const
    key_type</em>)(&amp; str)))) (...)’</p>
  </blockquote>
  
  <pre><code>test.h:
  
  #include....
  using namespace std;
  class test
  {
      public:
         std::map&lt;std::string, void(test::*)(int)&gt; mapping;
      void Add(int);
  };
  
  test.cpp:
  
  test::test()
  {
     mapping["Add"]=&amp;test::Add;
     string str = "Add";
     this.*mapping[str](3);// dosnt work!!!!
  }
  
  void test::Add(int a)
  {
     cout&lt;&lt;a&lt;&lt;endl;
  }
  </code></pre>
  
  <p>Dosnt work, please help me.</p>