mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 09:15:34 +08:00
refs #624 Use std alias traits.
This commit is contained in:
@@ -20,7 +20,7 @@ namespace XBus
|
||||
template <typename T> void *voidptr_cast(T i)
|
||||
{
|
||||
static_assert(std::is_integral<T>::value, "voidptr_cast expects an integer");
|
||||
typedef typename std::conditional<std::is_signed<T>::value, intptr_t, uintptr_t>::type intptr_type;
|
||||
using intptr_type = std::conditional_t<std::is_signed<T>::value, intptr_t, uintptr_t>;
|
||||
return reinterpret_cast<void *>(static_cast<intptr_type>(i));
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace XBus
|
||||
template <typename T> T intptr_cast(void *p)
|
||||
{
|
||||
static_assert(std::is_integral<T>::value, "voidptr_cast returns an integer");
|
||||
typedef typename std::conditional<std::is_signed<T>::value, intptr_t, uintptr_t>::type intptr_type;
|
||||
using intptr_type = std::conditional_t<std::is_signed<T>::value, intptr_t, uintptr_t>;
|
||||
return static_cast<T>(reinterpret_cast<intptr_type>(p));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user