Merge pull request #95 from lioncash/gen

MkCastTo: Use '_v' variants of type traits where applicable
This commit is contained in:
Phillip Stephens 2019-10-01 06:43:33 -07:00 committed by GitHub
commit 4d94923a23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -183,8 +183,8 @@ for tp in CENTITY_TYPES:
qual = getqualified(tp)
sourcef.write('''template <class T>
void TCastToPtr<T>::Visit(%s* p) {
static_assert(sizeof(T) > 0 && !std::is_void<T>::value, "TCastToPtr can not cast to incomplete type");
ptr = reinterpret_cast<T*>(std::is_convertible<%s*, T*>::value ? p : nullptr);
static_assert(sizeof(T) > 0 && !std::is_void_v<T>, "TCastToPtr can not cast to incomplete type");
ptr = static_cast<T*>(std::is_convertible_v<%s*, T*> ? p : nullptr);
}
''' % (qual, qual))