The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Bo (2) [Avatar] Offline
#1
In listing 2.7 of class joining_thread is it not lacking in a global swap like:

inline void swap(joining_thread& lhs, joining_thread& rhs) noexcept
{
	lhs.swap(rhs);
}

for better behaviour?

Minor points are defaulting the default constructor
joining_thread() noexcept =default;


Kind regards,
Bo Rydberg
anthony.williams (216) [Avatar] Offline
#2
Yes, you could add a free function
swap
overload, but that doesn't fundamentally change anything, since it's movable, so I didn't feel it was a necessary part of the code.

Yes, defaulting the default constructor is sensible.