Check if two types are the same without template instantiations
If you're using clang or GCC ≥10, you can use the __is_same(type1, type2) intrinsic.
For portability:
#if !defined(__is_same) &amp;&amp; (!defined(__clang__) || !defined(__GNUC__) || __GNUC__ &lt; 10)
#define IS_SAME(T1, T2) std::is_same_v&lt;T1, T2&gt;
#else
#define IS_SAME(T1, T2) __is_same(T1, T2)
#endif