Skip to content
Commit e61b7f0a authored by Rosen Penev's avatar Rosen Penev Committed by Karlchen
Browse files

remove const from several unique_ptrs



SonarLint reports:

If you use std::unique_ptr const & for a function parameter type, it
means that the function will not be able to alter the ownership of the
pointed-to object by the unique_ptr:

It cannot acquire ownership of the pointed-to object (this would require
a parameter of type std::unique_ptr)
It cannot transfer the object ownership to someone else (this would
require a std::unique_ptr &).
That means the function can only observe the pointed-to object, and in
this case passing a T* (if the unique_ptr can be null) or a T& (if it
cannot) provides the same features, while also allowing the function to
work with objects that are not handled by a unique_ptr (E.G. objects on
the stack, in a vector, or in another kind of smart pointer), thus making
the function more general-purpose.

Signed-off-by: default avatarRosen Penev <rosenp@gmail.com>
parent 0d5c9eea
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment