I see below notes in
Only non-constcan transfer the ownership of the managed object to another
unique_ptr. The lifetime of an object managed by const
unique_ptris limited to the scope in which the pointer was created.
You simply can not move from a
const std::unique_ptr and you can't use other modifying member functions -
reset either (these are logically non-const qualified, cannot be called on a
Transferring ownership implies resetting the old owner to non-owning state, thus modifying it.
const std::unique_ptr will manage at most one object through its lifetime (starting from its initialization).
In case of
std::unique_ptr const&, you won't be able to transfer ownership from the referenced (even non-const)
std::unique_ptr through this reference (const correctness).