C++ Logo

std-proposals

Advanced search

Re: std::parent_of_member

From: Martin Vejnár <vejnar.martin_at_[hidden]>
Date: Sat, 6 Nov 2021 08:24:05 +0100
Just to chime in, I have an implementation of the above (
https://github.com/avakar/container_of, without constexpr of course) and
also use it for intrusive containers (e.g.
https://github.com/avakar/intrusive_list). I was going to propose the
addition too, so this has +1 from me.

I'm not sure how discussion got this deep into implementation as it is way
compiler-specific (note that for msvc, the size of `T X::*` depends on
whether `X` has virtual bases or not). Constexpr-ness will indeed require
compiler magic.
-- 
Martin

Received on 2021-11-06 02:24:17