Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(950)

Unified Diff: src/utils/SkTLogic.h

Issue 263063002: Add pattern matchers for SkRecord (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: init pointers Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/record/SkRecordTraits.h ('k') | tests/RecordPatternTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/record/SkRecordTraits.h ('k') | tests/RecordPatternTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698