MCPcopy Create free account
hub / github.com/GameTechDev/PresentMon / MemberPointerOffset

Function MemberPointerOffset

IntelPresentMon/CommonUtilities/Meta.h:66–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64
65 template<typename S, typename M>
66 std::size_t MemberPointerOffset(M S::*memberPtr)
67 {
68 const S sample{};
69 const auto* base = reinterpret_cast<const uint8_t*>(&sample);
70 const auto* member = reinterpret_cast<const uint8_t*>(&(sample.*memberPtr));
71 return static_cast<std::size_t>(member - base);
72 }
73
74 // get the type of the elements in any iterable type (typically containers)
75 template<typename T>

Calls

no outgoing calls

Tested by

no test coverage detected