Boost logo

Boost :

From: Ivan Matek (libbooze_at_[hidden])
Date: 2024-12-07 16:27:45


On Sat, Dec 7, 2024 at 5:18 PM Vinnie Falco via Boost <boost_at_[hidden]>
wrote:

> 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:
>
>
I think this case itself can easily be handled by people casting T* to
std::uintptr_t.
I think bigger issue is that users can not do this when pointer is nested
inside a type.
E.g.
How can user hash
std::tuple<std::string, int*, int>
?
reinterpret cast to std::tuple<std::string, std::uintptr_t, int>

Yikes + UB.

>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk