▲ | AlotOfReading 5 days ago | |
It has no effect on the lifetime of the object, but it can affect the lifetime of the allocation. The reason is that weak_ptr needs the control block, which make_shared bundles into the same allocation as the object for optimization reasons. Quoting cppreference [0]:
[0] https://en.cppreference.com/w/cpp/memory/shared_ptr/make_sha... |