Date: Fri, 5 Nov 2021 20:50:03 -0400
On Fri, Nov 5, 2021 at 8:36 PM language.lawyer--- via Std-Proposals <
std-proposals_at_[hidden]> wrote:
> On 06/11/2021 03:12, Brian Bi via Std-Proposals wrote:
> > `reinterpret_cast<uintptr_t>(std::addressof(reinterpret_cast<ParentType
> > *>(0)->*member_ptr))` is UB. You have to use the magic `offsetof` macro.
> > P1278 <http://wg21.link/p1278> proposes to add a similar non-macro
> facility.
> >
> > The problem is how to then perform the pointer arithmetic and convert the
> > result into a pointer to the parent type. This cannot be done in user
> code
> > in C++17, so even at runtime, it would require compiler magic. If P1839
> > <http://wg21.link/P1839> gets accepted, it will be possible to
> implement it
> > in user code.
>
> I think this has already been discussed in this mail list: it won't be
> possible.
>
That was your interpretation of P1839R2, not the consensus of the list.
std-proposals_at_[hidden]> wrote:
> On 06/11/2021 03:12, Brian Bi via Std-Proposals wrote:
> > `reinterpret_cast<uintptr_t>(std::addressof(reinterpret_cast<ParentType
> > *>(0)->*member_ptr))` is UB. You have to use the magic `offsetof` macro.
> > P1278 <http://wg21.link/p1278> proposes to add a similar non-macro
> facility.
> >
> > The problem is how to then perform the pointer arithmetic and convert the
> > result into a pointer to the parent type. This cannot be done in user
> code
> > in C++17, so even at runtime, it would require compiler magic. If P1839
> > <http://wg21.link/P1839> gets accepted, it will be possible to
> implement it
> > in user code.
>
> I think this has already been discussed in this mail list: it won't be
> possible.
>
That was your interpretation of P1839R2, not the consensus of the list.
-- > Std-Proposals mailing list > Std-Proposals_at_[hidden] > https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals > -- *Brian Bi*
Received on 2021-11-05 19:50:20