【发布时间】:2018-04-27 09:08:00
【问题描述】:
class T 从 std::enable_shared_from_this<T> 继承有什么意义?我似乎不明白你为什么不直接创建一个std::shared_ptr<this>?
【问题讨论】:
-
首先,
this不是一个类型,你不能把它作为模板参数给shared_ptr。那么目的是允许在对象中安全地创建shared_ptr到this。
标签: c++11