4 ms·
>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 h
by smitherfield 9y ago
>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 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.