jeudi 11 mars 2021

Whats is the point of haveing enable_shared_from_this? [duplicate]

Can someone explain me the use cases of std::enable_shared_from_this, as I can understand, you can only create a shared_ptr using an object already owned by shared_ptr. Then why don't just use shared_ptr::operator= to create another shared_ptr owning the same resource instead of calling shared_from_this?

Aucun commentaire:

Enregistrer un commentaire