Add is_same type trait

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84029 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Douglas Gregor 2009-10-13 21:17:00 +00:00
parent 3a66a68b0c
commit 404aa26b26

View File

@ -49,6 +49,17 @@ struct is_class
enum { value = sizeof(char) == sizeof(dont_use::is_class_helper<T>(0)) }; enum { value = sizeof(char) == sizeof(dont_use::is_class_helper<T>(0)) };
}; };
/// \brief Metafunction that determines whether the two given types are
/// equivalent.
template<typename T, typename U>
struct is_same {
static const bool value = false;
};
template<typename T>
struct is_same<T, T> {
static const bool value = true;
};
// enable_if_c - Enable/disable a template based on a metafunction // enable_if_c - Enable/disable a template based on a metafunction
template<bool Cond, typename T = void> template<bool Cond, typename T = void>