title: Passing lambdas to std::thread and calling class methods
body: <p>I'm having a bit of trouble using std::thread together with lambdas. I have a method TheMethod where I should use std::thread to parallelize some function calls to methods in the same class.</p>
  
  <p>I define a lambda function, and try to pass it as follows to the std::thread instance I create:</p>
  
  <pre><code>auto functor = 
     [this](const Cursor&amp; c, size_t&amp; result) -&gt;void {result = classMethod(c);};
  
  size_t a;
  Cursor cursor = someCursor();
  
  std::thread t1(functor, cursor, a);
  
  t1.join();
  </code></pre>
  
  <p>Unfortunately, the compiler gives me:</p>
  
  <pre><code>  /usr/include/c++/4.8/functional:1697:61: error: no type named ‘type’ in ‘class std::result_of&lt;TheMethod...
  </code></pre>
  
  <p>I tried a lot of combinations in the lambda definition, and in the way of calling the std::thread constructor, but I get the same error always. The thread library is included, I link pthread too.</p>
  
  <p>Thanks for hints!</p>