Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumC++shared_ptr and weak_ptrSingle-choice MCQ

Why is calling `shared_from_this()` from inside a constructor undefined behavior?

struct Node : std::enable_shared_from_this<Node> { Node() { auto self = shared_from_this(); } };