From 00222e05f62c463f8cb54c38596bedafed3e33db Mon Sep 17 00:00:00 2001 From: terminx Date: Tue, 25 Jun 2019 11:30:08 +0000 Subject: [PATCH] Use remove_pointer_t instead of regular std::remove_pointer and add a definition for it for CXX11 builds git-svn-id: https://svn.eduke32.com/eduke32@7719 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/include/compat.h | 3 +++ source/duke3d/src/gameexec.cpp | 2 +- source/duke3d/src/gamestructures.cpp | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/source/build/include/compat.h b/source/build/include/compat.h index 68730b3fc..6ecf58579 100644 --- a/source/build/include/compat.h +++ b/source/build/include/compat.h @@ -733,6 +733,7 @@ using std::enable_if_t; using std::conditional_t; using std::make_signed_t; using std::make_unsigned_t; +using std::remove_pointer_t; # elif defined HAVE_CXX11_HEADERS template using enable_if_t = typename std::enable_if::type; @@ -742,6 +743,8 @@ template using make_signed_t = typename std::make_signed::type; template using make_unsigned_t = typename std::make_unsigned::type; +template +using remove_pointer_t = typename std::remove_pointer::type; # endif # ifdef HAVE_CXX11_HEADERS diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index af26040df..18620b931 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -640,7 +640,7 @@ GAMEEXEC_STATIC void VM_Move(void) auto const movflagsptr = &AC_MOVFLAGS(vm.pSprite, &actor[vm.spriteNum]); // NOTE: test against -1 commented out and later revived in source history // XXX: Does its presence/absence break anything? Where are movflags with all bits set created? - int const movflags = (*movflagsptr == (std::remove_pointer::type)-1) ? 0 : *movflagsptr; + int const movflags = (*movflagsptr == (remove_pointer_t)-1) ? 0 : *movflagsptr; int const deadflag = (A_CheckEnemySprite(vm.pSprite) && vm.pSprite->extra <= 0); AC_COUNT(vm.pData)++; diff --git a/source/duke3d/src/gamestructures.cpp b/source/duke3d/src/gamestructures.cpp index aa681e5e0..4dfdfda26 100644 --- a/source/duke3d/src/gamestructures.cpp +++ b/source/duke3d/src/gamestructures.cpp @@ -47,7 +47,7 @@ int32_t __fastcall VM_GetPalData(int const palNum, int32_t labelNum); #define LABEL_SETUP_UNMATCHED(struct, memb, name, idx) \ { \ name, idx, sizeof(struct[0].memb) | (is_unsigned::value ? LABEL_UNSIGNED : 0), 0, \ - offsetof(std::remove_pointer::type, memb) \ + offsetof(remove_pointer_t, memb) \ } #define LABEL_SETUP(struct, memb, idx) LABEL_SETUP_UNMATCHED(struct, memb, #memb, idx)