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
This commit is contained in:
terminx 2019-06-25 11:30:08 +00:00 committed by Christoph Oelckers
parent 3130b51a96
commit 00222e05f6
3 changed files with 5 additions and 2 deletions

View file

@ -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 <bool B, class T = void>
using enable_if_t = typename std::enable_if<B, T>::type;
@ -742,6 +743,8 @@ template <typename T>
using make_signed_t = typename std::make_signed<T>::type;
template <typename T>
using make_unsigned_t = typename std::make_unsigned<T>::type;
template <class T>
using remove_pointer_t = typename std::remove_pointer<T>::type;
# endif
# ifdef HAVE_CXX11_HEADERS

View file

@ -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<decltype(movflagsptr)>::type)-1) ? 0 : *movflagsptr;
int const movflags = (*movflagsptr == (remove_pointer_t<decltype(movflagsptr)>)-1) ? 0 : *movflagsptr;
int const deadflag = (A_CheckEnemySprite(vm.pSprite) && vm.pSprite->extra <= 0);
AC_COUNT(vm.pData)++;

View file

@ -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<decltype(struct[0].memb)>::value ? LABEL_UNSIGNED : 0), 0, \
offsetof(std::remove_pointer<decltype(&struct[0])>::type, memb) \
offsetof(remove_pointer_t<decltype(&struct[0])>, memb) \
}
#define LABEL_SETUP(struct, memb, idx) LABEL_SETUP_UNMATCHED(struct, memb, #memb, idx)