[meta] Add hb_is_same()
authorBehdad Esfahbod <behdad@behdad.org>
Wed, 3 Apr 2019 21:15:01 +0000 (14:15 -0700)
committerBehdad Esfahbod <behdad@behdad.org>
Wed, 3 Apr 2019 21:15:01 +0000 (14:15 -0700)
src/hb-meta.hh

index 63c8a8c..c009563 100644 (file)
@@ -92,15 +92,18 @@ template <bool b> struct hb_bool_tt { enum { value = b }; };
 typedef hb_bool_tt<true> hb_true_t;
 typedef hb_bool_tt<false> hb_false_t;
 
-
 template<bool B, typename T = void>
 struct hb_enable_if {};
-
 template<typename T>
 struct hb_enable_if<true, T> { typedef T type; };
-
 #define hb_enable_if(Cond) typename hb_enable_if<(Cond)>::type* = nullptr
 
+template <typename T, typename T2>
+struct hb_is_same : hb_false_t {};
+template <typename T>
+struct hb_is_same<T, T> : hb_true_t {};
+#define hb_is_same(T, T2) hb_is_same<T, T2>::value
+
 
 /*
  * Meta-functions.