samedi 26 octobre 2019

C++ primer 5 edition: shared_ptr initialized from uniqe_ptr?

On C++ primer 5 edition. Chapter 12. Dynamic memory: It is written:

shared_ptr p(u); P assumes ownership from the uniqe_ptr u; makes u null. shared_ptr p(q, d) Assumes ownership for the object to which the built-in pointer q points. q must be convertible to T* ($4.11.2, p.161). p will use the callable object d ($10.3.2, p.388) in place of delete to free q.

  • I didn't understand "Assumes ownership from the unque_ptr and for the object to which the built-in...".

Can someone explain to me this paragraph? Thanks so much.

Aucun commentaire:

Enregistrer un commentaire