types/traits: add the identity type function
This commit is contained in:
parent
a95388b02b
commit
6c0803b6e9
@ -56,6 +56,22 @@ namespace util {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
namespace util::types {
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
/// CXX20: An early implementation of std::identity_t and related
|
||||||
|
/// structures; useful for disabling template argument deduction, and
|
||||||
|
/// higher order template functions.
|
||||||
|
template <typename T>
|
||||||
|
struct identity { using type = T; };
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
template <typename T>
|
||||||
|
using identity_t = typename identity<T>::type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
template <typename T> struct is_dereferencable : std::false_type { };
|
template <typename T> struct is_dereferencable : std::false_type { };
|
||||||
template <typename T> struct is_dereferencable<T*> : std::true_type { };
|
template <typename T> struct is_dereferencable<T*> : std::true_type { };
|
||||||
|
Loading…
Reference in New Issue
Block a user