TypeTraits: Remove const, volatile, and reference
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
apio 2022-12-31 11:50:30 +01:00
parent e2e21923d7
commit 831711ab7e
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -2,3 +2,48 @@
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 <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>>;