Resource management
R.33
Take a `unique_ptr<widget>&` parameter to express that a function reseats the `widget`
Reason
Using unique_ptr in this way both documents and enforces the function call's reseating semantics.
Note
"reseat" means "making a pointer or a smart pointer refer to a different object."
Example
void reseat(unique_ptr<widget>&); // "will" or "might" reseat pointer
Enforcement
- (Simple) Warn if a function takes a
Unique_pointer<T>parameter by lvalue reference and does not either assign to it or callreset()on it on at least one code path. Suggest taking aT*orT&instead.