xiaoweiChen / CPP-Concurrency-In-Action-2ed-2019

:book: 作为对《C++ Concurrency in Action - SECOND EDITION》的中文翻译。

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

翻译有误

zhourongtu opened this issue · comments

commented

2.3 转移所有权中
代码2.7下面的一段话。

std::thread对象的容器,如果这个容器是移动敏感的(比如,标准中的std::vector<>),那么移动操作同样适用于这些容器。了解这些后,就可以写出类似代码2.7中的代码,代码量产了一些线程,并且等待它们结束。

原文

The move support in std::thread also allows for containers of std::thread objects, if those containers are move-aware (like the updated std::vector<>).This means that you can write code like that in the following listing, which spawns a numbers of threads and then waits for them to finish.

建议改成

在std::thread中对移动语义的支持同样适用于使用std::thread的容器对象,前提是那些容器同样是移动敏感的(move-aware),例如std::vector<>。了解这些后,就可以写出类似代码2.8中的代码。2.8通过容器量产了一些线程,并等待它们结束。

原因:原文中强调的是2.8的代码,而不是2.7的代码,这里具有误导性。

非常感谢勘误!这里的确是翻译时理解有误。