move使用的问题点
主要鉴赏一些move写出来的bug
for里使用move
在for里使用move需要考虑细致一点,鉴定一个场景
1
2
3
4
5
6
7
8
9
10
11
std::unique_ptr<Task> task(...)
for (0..theadpool.size()) {
threadpool[i].run(std::move(task));
}
ThreadPool::run(UniqueTask task) {
// without check task
// ...
task->run();
// ...
}
这里是一个全网故障点QAQ
This post is licensed under CC BY 4.0 by the author.