c++ - std::enable_shared_from_this<> - missing is_shared()? -
shared_from_this()
has undefined behavior if object not shared.
but if shared, know relevant "control block" (effective modern c++, item 19). why std::enable_shared_from_this<>
not add is_shared()
function returns true or false, object shared or not?
std::enable_shared_from_this<>
seems introduce kind of dependency inversion. object depends on way used. is_shared()
function @ least "adapt" mixed mode usage.
Comments
Post a Comment