Billy Donahue (4) [Avatar] Offline
#1
Hi Anthony,

On pg31 (35 of the PDF), Listing 2.8, there's a

std::mem_fn(&std::thread::join)

Which assumes a particular overload set for std::thread::join. This is a guarantee the standard doesn't give us, but it will probably work mostly for now or something. Maybe this could be restated to avoid the member function assumption on a std:: library class.
anthony.williams (216) [Avatar] Offline
#2
Thanks for pointing this out
georger.araujo (6) [Avatar] Offline
#3
Billy Donahue wrote:Hi Anthony,

On pg31 (35 of the PDF), Listing 2.8, there's a

std::mem_fn(&std::thread::join)

Which assumes a particular overload set for std::thread::join. This is a guarantee the standard doesn't give us, but it will probably work mostly for now or something. Maybe this could be restated to avoid the member function assumption on a std:: library class.

That statement is also present in Listings 2.9, 8.2, and 8.3.

I didn't quite understand what was the issue until I stumbled upon this.

I suppose the following code would be preferable?
for (auto& t : threads)
{
    t.join();
}