diff options
author | bunnei <bunneidev@gmail.com> | 2021-05-01 23:32:36 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2021-05-06 01:40:54 +0200 |
commit | e02785be83dd3d02a8fc7aebc13337546f04bab8 (patch) | |
tree | 22e7f675936fbacb8d7c188b4263719a65113d94 /src/common | |
parent | fixup! common: intrusive_red_black_tree: Disable static_assert that will not evaluate as constant on MSVC. (diff) | |
download | yuzu-e02785be83dd3d02a8fc7aebc13337546f04bab8.tar yuzu-e02785be83dd3d02a8fc7aebc13337546f04bab8.tar.gz yuzu-e02785be83dd3d02a8fc7aebc13337546f04bab8.tar.bz2 yuzu-e02785be83dd3d02a8fc7aebc13337546f04bab8.tar.lz yuzu-e02785be83dd3d02a8fc7aebc13337546f04bab8.tar.xz yuzu-e02785be83dd3d02a8fc7aebc13337546f04bab8.tar.zst yuzu-e02785be83dd3d02a8fc7aebc13337546f04bab8.zip |
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/parent_of_member.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/common/parent_of_member.h b/src/common/parent_of_member.h index d9a14529d..e0f8ab5c8 100644 --- a/src/common/parent_of_member.h +++ b/src/common/parent_of_member.h @@ -133,27 +133,27 @@ template <auto MemberPtr> using GetMemberType = typename GetMemberPointerTraits<decltype(MemberPtr)>::Member; template <auto MemberPtr, typename RealParentType = GetParentType<MemberPtr>> -static inline std::ptrdiff_t OffsetOf = [] { +constexpr std::ptrdiff_t OffsetOf() { using DeducedParentType = GetParentType<MemberPtr>; using MemberType = GetMemberType<MemberPtr>; static_assert(std::is_base_of<DeducedParentType, RealParentType>::value || std::is_same<RealParentType, DeducedParentType>::value); return OffsetOfCalculator<RealParentType, MemberType>::OffsetOf(MemberPtr); -}(); +}; } // namespace impl template <auto MemberPtr, typename RealParentType = impl::GetParentType<MemberPtr>> constexpr RealParentType& GetParentReference(impl::GetMemberType<MemberPtr>* member) { - std::ptrdiff_t Offset = impl::OffsetOf<MemberPtr, RealParentType>; + std::ptrdiff_t Offset = impl::OffsetOf<MemberPtr, RealParentType>(); return *static_cast<RealParentType*>( static_cast<void*>(static_cast<uint8_t*>(static_cast<void*>(member)) - Offset)); } template <auto MemberPtr, typename RealParentType = impl::GetParentType<MemberPtr>> constexpr RealParentType const& GetParentReference(impl::GetMemberType<MemberPtr> const* member) { - std::ptrdiff_t Offset = impl::OffsetOf<MemberPtr, RealParentType>; + std::ptrdiff_t Offset = impl::OffsetOf<MemberPtr, RealParentType>(); return *static_cast<const RealParentType*>(static_cast<const void*>( static_cast<const uint8_t*>(static_cast<const void*>(member)) - Offset)); } |