[meta] Add hb_is_same()

This commit is contained in:
Behdad Esfahbod 2019-04-03 14:15:01 -07:00
parent 6215fb8e68
commit 2778df7972
1 changed files with 6 additions and 3 deletions

View 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.