TypeTraits: Remove const, volatile, and reference
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
e2e21923d7
commit
831711ab7e
@ -1,4 +1,49 @@
|
||||
#pragma once
|
||||
|
||||
template <typename Base, typename Derived> inline constexpr bool IsBaseOf = __is_base_of(Base, Derived);
|
||||
template <typename T, T value> inline constexpr bool IsPowerOfTwo = (value & (value - 1)) == 0;
|
||||
template <typename T, T value> inline constexpr bool IsPowerOfTwo = (value & (value - 1)) == 0;
|
||||
|
||||
template <class T> struct __remove_const_impl
|
||||
{
|
||||
using type = T;
|
||||
};
|
||||
|
||||
template <class T> struct __remove_const_impl<T const>
|
||||
{
|
||||
using type = T;
|
||||
};
|
||||
|
||||
template <class T> using RemoveConst = __remove_const_impl<T>::type;
|
||||
|
||||
template <class T> struct __remove_volatile_impl
|
||||
{
|
||||
using type = T;
|
||||
};
|
||||
|
||||
template <class T> struct __remove_volatile_impl<T volatile>
|
||||
{
|
||||
using type = T;
|
||||
};
|
||||
|
||||
template <class T> using RemoveVolatile = __remove_volatile_impl<T>::type;
|
||||
|
||||
template <class T> using RemoveCV = RemoveVolatile<RemoveConst<T>>;
|
||||
|
||||
template <class T> struct __remove_ref_impl
|
||||
{
|
||||
using type = T;
|
||||
};
|
||||
|
||||
template <class T> struct __remove_ref_impl<T&>
|
||||
{
|
||||
using type = T;
|
||||
};
|
||||
|
||||
template <class T> struct __remove_ref_impl<T&&>
|
||||
{
|
||||
using type = T;
|
||||
};
|
||||
|
||||
template <class T> using RemoveReference = __remove_ref_impl<T>::type;
|
||||
|
||||
template <class T> using RemoveCVReference = RemoveCV<RemoveReference<T>>;
|
Loading…
Reference in New Issue
Block a user