It's common to inherit from enable_shared_from_this just to be able to return shared_ptr's from member functions as the primary intention, with no intention of exposing enable_shared_from_this API in the derived class.
Since to make use of enable_shared_from_this one must do so through public inheritance (does the standard mandates this? what's the rationale?), this can't be achieved and enable_shared_from_this API is forced into derived class API.
Inherenting enable_shared_from_this privately and making shared_ptr a friend class do work on clang coupled with libc++, but doesn't work with stdlibc++.
Aucun commentaire:
Enregistrer un commentaire