title: C++ thread error: no type named ‘type’
body: <p>i know that this topic was asked a lot of time but I don't understand where is the error in my code.</p>
  
  <p>I have a foo.h file where I have defined:</p>
  
  <pre><code>class Foo {
      public:
         Foo();
         ~Foo();
         void DoSomething(cv::Mat&amp; img);
         void DoSomethingAsync(cv::Mat&amp; img);
  
      private:
         bool isFinished = false;
  };
  </code></pre>
  
  <p>then a foo.cpp like this:</p>
  
  <pre><code>Foo:Foo() {}
  
  Foo:~Foo() {}
  
  void Foo::DoSomethingAsync(cv::Mat&amp; img) {
  try {
      IsFinished = true;
  } catch(exception&amp; e) {
  }   
  
  void Foo::DoSomething(cv::Mat&amp; img) {
   thread_mutex.lock();
   thread_async = std::move(std::thread(&amp;Foo::DoSomethingAsync, this, img));
  thread_mutex.unlock();
  }
  </code></pre>
  
  <p>from my main.cpp file I call the function:</p>
  
  <pre><code>Foo foo;
  foo.DoSomething(im);
  </code></pre>
  
  <p>when I compile, I always obtain this error:</p>
  
  <pre><code>error: no type named ‘type’ in ‘class std::result_of&lt;std::_Mem_fn&lt;void (ObjectDetector::*)(cv::Mat&amp;)&gt;(ObjectDetector*, cv::Mat)&gt;’
     typedef typename result_of&lt;_Callable(_Args...)&gt;::type result_type;
                                                           ^
  /usr/include/c++/5/functional:1526:9: error: no type named ‘type’ in ‘class std::result_of&lt;std::_Mem_fn&lt;void (ObjectDetector::*)(cv::Mat&amp;)&gt;(ObjectDetector*, cv::Mat)&gt;’
       _M_invoke(_Index_tuple&lt;_Indices...&gt;)
  </code></pre>
  
  <p>Could you explain me why? </p>
  
  <p>in my CMake I set the variable CMAKE_CXX_FLAGS with -pthread</p>