Index: src/utils/SkTLogic.h |
diff --git a/src/utils/SkTLogic.h b/src/utils/SkTLogic.h |
index 62952ad13c267d88e911a34a25a34cebc2bd5835..c97849d2da2be5408216a917c0da153be24f6633 100644 |
--- a/src/utils/SkTLogic.h |
+++ b/src/utils/SkTLogic.h |
@@ -89,4 +89,11 @@ public: |
static const bool value = sizeof(func<Derived>(NULL)) == sizeof(uint16_t); \ |
} |
+/** SK_WHEN_TYPE is type T if cond_type exists, otherwise it does not exist. |
+ * You can use this to enable specializations conditioned on whether a type exists. |
+ */ |
+#define SK_WHEN_TYPE(cond_type, T) typename SkWhenType<cond_type, T>::type |
+template <typename cond_type, typename T> |
+struct SkWhenType { typedef T type; }; |
+ |
bungeman-skia
2014/05/05 19:37:51
So it seems the 'normal' way to do this would be t
mtklein
2014/05/05 20:05:12
Strongly agreed and done.
|
#endif |