I try to insert into vector with a class including condition variable,my code as follow:
class LockRequest {
public:
LockRequest( ) : granted_(false) {}
bool granted_;
};
class LockRequestQueue {
public:
std::list<LockRequest> request_queue_;
std::condition_variable cv_; // for notifying blocked transactions on this rid
bool upgrading_ = false;
};
int main(){
LockRequestQueue request;
std::vector<LockRequestQueue> vecs;
vecs.push_back(request);
return 0;
}
but I get error.When I remove the condition variable cv_,the result is correct.How can I fix this problem??