From f13b2483760ee0e5f2a9ed1370e249cc03895008 Mon Sep 17 00:00:00 2001 From: Silent Date: Thu, 26 Apr 2018 09:32:51 +0200 Subject: [PATCH] Streamlined std::variant usage --- SilentPatch/MemoryMgr.GTA.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/SilentPatch/MemoryMgr.GTA.h b/SilentPatch/MemoryMgr.GTA.h index 1207452..c5ca8f1 100644 --- a/SilentPatch/MemoryMgr.GTA.h +++ b/SilentPatch/MemoryMgr.GTA.h @@ -246,10 +246,10 @@ namespace Memory switch ( bVer ) { case 1: - if ( std::holds_alternative(address11) ) return HandlePattern( std::get(address11) ); + if ( auto pao = std::get_if(&address11) ) return HandlePattern( *pao ); else { - const uintptr_t addr = std::get(address11); + const uintptr_t addr = *std::get_if(&address11); #ifdef assert assert(addr); #endif @@ -262,10 +262,10 @@ namespace Memory return AdjustAddress_11(addr); } case 2: - if ( std::holds_alternative(addressSteam) ) return HandlePattern( std::get(addressSteam) ); + if ( auto pao = std::get_if(&addressSteam) ) return HandlePattern( *pao ); else { - const uintptr_t addr = std::get(addressSteam); + const uintptr_t addr = *std::get_if(&addressSteam); #ifdef assert assert(addr); #endif @@ -278,10 +278,10 @@ namespace Memory case 3: return GetDummy(); case 4: - if ( std::holds_alternative(addressNewsteamR2) ) return HandlePattern( std::get(addressNewsteamR2) ); + if ( auto pao = std::get_if(&addressNewsteamR2) ) return HandlePattern( *pao ); else { - const uintptr_t addr = std::get(addressNewsteamR2); + const uintptr_t addr = *std::get_if(&addressNewsteamR2); #ifdef assert assert(addr); #endif @@ -291,10 +291,10 @@ namespace Memory return DynBaseAddress(addr); } case 5: - if ( std::holds_alternative(addressNewsteamR2_LV) ) return HandlePattern( std::get(addressNewsteamR2_LV) ); + if ( auto pao = std::get_if(&addressNewsteamR2) ) return HandlePattern( *pao ); else { - const uintptr_t addr = std::get(addressNewsteamR2_LV); + const uintptr_t addr = *std::get_if(&addressNewsteamR2_LV); #ifdef assert assert(addr); #endif @@ -304,10 +304,10 @@ namespace Memory return DynBaseAddress(addr); } default: - if ( std::holds_alternative(address10) ) return HandlePattern( std::get(address10) ); + if ( auto pao = std::get_if(&address10) ) return HandlePattern( *pao ); else { - const uintptr_t addr = std::get(address10); + const uintptr_t addr = *std::get_if(&address10); #ifdef assert assert(addr); #endif