title: c++ condition_variable wait_for predicate in my class, std::thread <unresolved overloaded function type> error
body: <p>I am trying to use a thread within my class, then the thread needs to use a <code>condition_variable</code>, and the condition variable will be blocked until a predicate be changed to <code>true</code>. The code looks like this:</p>
  
  <pre><code>class myThreadClass{
      bool bFlag;
      thread t ;
      mutex mtx;
      condition_variable cv;
  
      bool myPredicate(){
        return bFlag;
      }
  
      int myThreadFunction(int arg){
         while(true){
             unique_lock&lt;mutex&gt; lck(mtx);
             if(cv.wait_for(lck,std::chrono::milliseconds(3000),myPredicate)) //something wrong?  
                  cout&lt;&lt;"print something...1"&lt;&lt;endl 
             else
                  cout&lt;&lt;"print something...2"&lt;&lt;endl 
         }
      }
  
      void createThread(){
          t = thread(&amp;myThreadClass::myThreadFunction,this,10);//this is ok
      }
  
  } ;
  </code></pre>
  
  <p>This code on compilation throws an error saying:</p>
  
  <blockquote>
    <p>unresolved overloaded function type in the line “wait_for”.</p>
  </blockquote>
  
  <p>Then i try modify it to:</p>
  
  <pre><code>if(cv.wait_for(lck,std::chrono::milliseconds(3000),&amp;myThreadClass::myPredicate))
  </code></pre>
  
  <p>But there is still an error.</p>