
7 Dec
2024
7 Dec
'24
4:17 p.m.
On Sat, Dec 7, 2024 at 7:27 AM Klemens Morgenstern via Boost < boost@lists.boost.org> wrote:
I wonder about the usefulness of pointers.
A use-case for pointers is: std::unordered_map< T*, std::weak_ptr<T> > Where the T is constructed via std::make_shared. Note: If any std::weak_ptr references the control block created by std::make_shared after the lifetime of all shared owners ended, the memory occupied by T persists until all weak owners get destroyed as well, which may be undesirable if sizeof(T) is large. Thanks