40 static inline constexpr
void *
43 return (
char *)p + offset;
49 static inline constexpr
const void *
52 return (
const char *)p + offset;
55 template<
typename T,
typename U>
56 static inline constexpr T *
62 template<
typename T,
typename U>
63 static inline constexpr T *
69 template<
class C,
class A>
70 static constexpr
inline ptrdiff_t
73 return ptrdiff_t((
const char *)null_c - (
const char *)&(null_c->*p));
76 template<
class C,
class A>
77 static constexpr
inline ptrdiff_t
80 return ContainerAttributeOffset<C, A>(
nullptr, p);
86 template<
class C,
class A>
87 #if CLANG_OR_GCC_VERSION(4,7) 93 return *OffsetCast<C, A>(&a, ContainerAttributeOffset<C, A>(member));
99 template<
class C,
class A>
100 #if CLANG_OR_GCC_VERSION(4,7) 103 static inline const C &
106 return *OffsetCast<const C, const A>(&a, ContainerAttributeOffset<C, A>(member));
static constexpr ptrdiff_t ContainerAttributeOffset(const C *null_c, const A C::*p)
static C & ContainerCast(A &a, A C::*member)
Cast the given pointer to a struct member to its parent structure.
static constexpr void * OffsetPointer(void *p, ptrdiff_t offset)
Offset the given pointer by the specified number of bytes.
static constexpr T * OffsetCast(U *p, ptrdiff_t offset)