jeudi 25 février 2016

lifetime of an object managed by const std::unique_ptr

I see below notes in http://ift.tt/12HCXZS, Is there anyone can explain it with an example? I could not figure it out why.

Only non-const unique_ptr can transfer the ownership of the managed object to another unique_ptr. The lifetime of an object managed by const std::unique_ptr is limited to the scope in which the pointer was created.

Aucun commentaire:

Enregistrer un commentaire