title: Rebinding a function pointer in copy constructor
body: <p>I have a class with a list of function pointers.
  These function pointers point to a member function of a sub-class, which was bound like this:</p>
  
  <pre><code>functionList.push_back(std::bind(&amp;SubClass::function, this, std::placeholders::_1,    std::placeholders::_2));
  </code></pre>
  
  <p>Now, when copying the class with functionList, the function pointers still point to the old class. 
  How can I rebind the function pointer to the new class?</p>
  
  <p>Here an example code:</p>
  
  <pre><code>#include &lt;vector&gt;
  #include &lt;functional&gt;
  
  class SomeClass
  {
  
  };
  
  class testClass
  {
  public:
      typedef std::function&lt;void(const SomeClass&amp; var1, const SomeClass&amp; var2)&gt; transitionFunction;
  
  
  
  
      testClass(){}
      testClass(const testClass&amp;s)
      {
          for(transitionFunction func : s.functionList)
          {
              // how to rebind the function pointer to the new this?
              functionList.push_back("???");
          }
      }
  
      std::vector&lt;transitionFunction&gt; functionList;
  
  
  };
  
  
  class SubClass : public testClass
  {
      SubClass()
      {
          functionList.push_back(std::bind(&amp;SubClass::function, this, std::placeholders::_1,    std::placeholders::_2));
      }
  
      void function(const SomeClass&amp; var1, const SomeClass&amp; var2)
      {
  
      }
  
  };
  </code></pre>
  
  <p>Thanks!</p>