enable_shared_from_this - empty internal weak pointer?
问题 I'm using enable_shared_from_this<Base> and then inherit from Base . When trying to use shared_from_this() in Derived 's constructor (not initializer list), I get an exception. Turns out that the internal weak pointer is null and doesn't point to this at all. How can this happen? My other use case of exactly this works perfectly fine. I don't even know where to start. I looked down at the source code of enable_shared_from_this , and it looks to me like that pointer would always be nullptr.