title: Emplacing a thread object into a vector where the function is a member function and need return value
body: <pre><code>std::atomic&lt;unsigned int&gt; sum(0);
  std::vector&lt;std::thread&gt; myThreads;
  MyBaseObj *myObj = new MyDerivedObject();
  </code></pre>
  
  <p>MyDerivedObject has a member function which is declared as follows:</p>
  
  <pre><code>unsigned int MyDerivedObject::DoSomething(unsigned int paramA, double paramB);
  </code></pre>
  
  <p>How can I launch this "DoSomething" method (and other methods with the same signature) in a thread, give it parameters, and add it's return value to "sum"?</p>
  
  <p>I can do something like the following, but I cant figure out the syntax of how to emplace this into my vector.</p>
  
  <pre><code>auto threadFunc = [](std::function&lt;unsigned int(MyBaseObj&amp;,unsigned int,double)&gt; memberFunc, 
                       MyBaseObj &amp;myObj
                       unsigned int number1, 
                       double number 2) {
      sum += memberFunc(myObj,number1,number2);
  };
  </code></pre>