Std :: enable_shared_from_this: разрешено ли называть shared_from_this () в деструкторе?C++

Программы на C++. Форум разработчиков
Anonymous
Std :: enable_shared_from_this: разрешено ли называть shared_from_this () в деструкторе?

Сообщение Anonymous »

Код: Выделить всё

#include 
#include 

struct A : public std::enable_shared_from_this
{
~A()
{
auto this_ptr = shared_from_this(); // std::bad_weak_ptr exception here.
std::cout 

Подробнее здесь: [url]https://stackoverflow.com/questions/28338978/stdenable-shared-from-this-is-it-allowed-to-call-shared-from-this-in-destru[/url]

Вернуться в «C++»