#include<iostream>
#include<thread>
class scoped_thread {
std::thread t;
public:
explicit scoped_thread(std::thread _t) : t(std::move(_t)) {
if (!t.joinable()) {
throw std::logic_error("No thread");
}
}
~scoped_thread() {
t.join();
}
scoped_thread(scoped_thread const&) = delete;
scoped_thread& operator=(scoped_thread const&) = delete;
};
04-04
417
417
11-22
9619
9619

被折叠的 条评论
为什么被折叠?



