I am trying to add a condition_variable to handle threads, but get a compilation error at this line:
this->cv.wait(lk, []{return this->ready;});
You need to capture the this pointer:
this
this->cv.wait(lk, [this]{return ready;});