|
Boost : |
From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2024-12-07 16:17:48
On Sat, Dec 7, 2024 at 7:27â¯AM Klemens Morgenstern via Boost <
boost_at_[hidden]> 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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk