introspection/name: add member_offset query for pointer-to-member
This commit is contained in:
parent
de1d9649a3
commit
6ba13aa25e
@ -168,6 +168,15 @@ namespace cruft::introspection::name {
|
||||
}
|
||||
|
||||
|
||||
constexpr std::size_t
|
||||
member_offset (auto ptr)
|
||||
{
|
||||
using klass_t = typename pointer_to_member_class<decltype (ptr)>::type;
|
||||
klass_t instance {};
|
||||
return std::uintptr_t (&(instance.*ptr)) - std::uintptr_t (&instance);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
struct type_char;
|
||||
|
Loading…
Reference in New Issue
Block a user