Index: src/utils/SkTLogic.h |
diff --git a/src/utils/SkTLogic.h b/src/utils/SkTLogic.h |
index 62952ad13c267d88e911a34a25a34cebc2bd5835..925d4bdcd4fb3d514d0197f10d5815165aa120e6 100644 |
--- a/src/utils/SkTLogic.h |
+++ b/src/utils/SkTLogic.h |
@@ -89,4 +89,14 @@ public: |
static const bool value = sizeof(func<Derived>(NULL)) == sizeof(uint16_t); \ |
} |
+// Same sort of thing as SK_CREATE_MEMBER_DETECTOR, but checks for the existence of a nested type. |
+#define SK_CREATE_TYPE_DETECTOR(type) \ |
+template <typename T> \ |
+class HasType_##type { \ |
+ template <typename U> static uint8_t func(typename U::type*); \ |
+ template <typename U> static uint16_t func(...); \ |
+public: \ |
+ static const bool value = sizeof(func<T>(NULL)) == sizeof(uint8_t); \ |
+} |
+ |
#endif |