Binding to a link requires one smaller move:
void f(std::unique_ptr<T>&& p) { g(std::move(p)); } f(std::make_unique<T>());
Binding to an object parameter requires one actual move:
void f(std::unique_ptr<T> p) { g(std::move(p)); } f(std::make_unique<T>());
An additional move includes one copy of the pointer, one setting of the pointer to zero, and one destructor with state checking. It's not a big cost, and the question of which style to use depends on the type of code you write:
The larger your code and the less it is used, the more simple the buy-in version gives you simplicity. Conversely, the more the library has your code and the less you know your users, the greater the value is not to impose an inevitable cost, no matter how small.
You decide.
source share