+ 2
RAII for Thread | Movable thread
Hi I have implemented RAII for thread using thread object as reference like thread& t in attached code. I know thread cannot be copied but can be moved. Is it possible to implement by any chance with RAII class have member as thread t? Basically, I want to move constructor argument thread to member variable thread t from move constructor, but it is not working. Like below: thread t; myThread(myThread&& t) noexcept : t(move(t)) {} Feel free to ask for any query. https://code.sololearn.com/cjKMg2Pdjapx/?ref=app
2 Respostas
+ 1
Did you want something like this?
https://code.sololearn.com/c49la3Tzh3cU/?ref=app
0
Thanks Volodymyr Chelnokov perfect..exactly what I was looking for