I am trying to create a member function that returns whether it has stored to shared_ptr
.
class X : public std::enable_shared_from_this {
...
bool is_shared() const {
return shared_from_this();
}
};
...
(new X())->is_shared(); // -> false?
Is this legal? In this case, is shared_from_this() guaranteed to return null and not throw any exception?
Aucun commentaire:
Enregistrer un commentaire