I would like to have member function that accepts both left and right references to some class and moves it's object. Currently I have two separate functions:
void ThrSafeQueue::push(Obj&& x) {
lock_guard(mutex_);
queue_.push(x);
}
void ThrSafeQueue::push(Obj& x) {
lock_guard(mutex_);
queue_.push(std::move(x));
}
Aucun commentaire:
Enregistrer un commentaire