Hi there!
Listing 6.9 and 6.10 contain a comparison of a unique_ptr with a raw pointer:
See here and here, which fails to compile.
This is done correctly in other places in Listing 6.10 though, where head.get() is used instead.
Furthermore, Listing 6.9 declares a unique_ptr const
std::unique_ptr<node> const old_head=std::move(head);
This fails to compile as well, see here, as the const pointer cannot be returned any more.
Interestingly, none of these occur in the book. It might hence be better to use the code from the book instead. I wonder why those two are out of sync though :-)
Lastly, in Listing 6.9, a local object is moved, see here
return std::move(head_lock);
This prevents copy elision, and leads to an error with my compiler as well. A simple return would do here. This is in the Listing here and in the book.
Cheers
Lucas
Hi there!
Listing 6.9 and 6.10 contain a comparison of a
unique_ptrwith a raw pointer:See here and here, which fails to compile.
This is done correctly in other places in Listing 6.10 though, where
head.get()is used instead.Furthermore, Listing 6.9 declares a
unique_ptr constThis fails to compile as well, see here, as the const pointer cannot be returned any more.
Interestingly, none of these occur in the book. It might hence be better to use the code from the book instead. I wonder why those two are out of sync though :-)
Lastly, in Listing 6.9, a local object is moved, see here
This prevents copy elision, and leads to an error with my compiler as well. A simple return would do here. This is in the Listing here and in the book.
Cheers
Lucas