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

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: yet more notes 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..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
« 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