Re:Modernize C++: Sink Functions
by smitherfield on Thursday December 07, 2017 @01:30PM
(#15872642)
>Isn't this what a `unique_ptr` is (a RAII class that manages Heap allocation)?
See my reply to kllrnohj above: https://news.ycombinator.com/item?id=15872509
>Why not [write sink functions that] take by value?
That could work in the case where the parameter is a class which is movable but not copyable, but I'd still prefer an rvalue reference in that case because it makes your meaning obvious without having to refer to the class definition or documentation.
Isn't this what a `unique_ptr` is (a RAII class that manages Heap allocation)?
> sink functions" should take an rvalue reference (which semantically means "take ownership of this parameter").
Why not take by value?