[llvm-commits] [llvm] r84029 - /llvm/trunk/include/llvm/Support/type_traits.h

Douglas Gregor dgregor at apple.com
Tue Oct 13 14:17:00 PDT 2009


Author: dgregor
Date: Tue Oct 13 16:17:00 2009
New Revision: 84029

URL: http://llvm.org/viewvc/llvm-project?rev=84029&view=rev
Log:
Add is_same type trait

Modified:
    llvm/trunk/include/llvm/Support/type_traits.h

Modified: llvm/trunk/include/llvm/Support/type_traits.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/type_traits.h?rev=84029&r1=84028&r2=84029&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/type_traits.h (original)
+++ llvm/trunk/include/llvm/Support/type_traits.h Tue Oct 13 16:17:00 2009
@@ -49,6 +49,17 @@
     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
 template<bool Cond, typename T = void>





More information about the llvm-commits mailing list