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

Unified Diff: src/utils/SkTLogic.h

Issue 269543025: Partially restore small-T optimization for very small (empty) T. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: SkTIsEmpty 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/SkRecord.h ('k') | tests/RecordOptsTest.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 925d4bdcd4fb3d514d0197f10d5815165aa120e6..e89d7431962b3417babb32d59cbf5643f21ae890 100644
--- a/src/utils/SkTLogic.h
+++ b/src/utils/SkTLogic.h
@@ -30,6 +30,14 @@ template <typename T, T v> struct SkTIntegralConstant {
/** Convenience specialization of SkTIntegralConstant. */
template <bool b> struct SkTBool : SkTIntegralConstant<bool, b> { };
+/** Is T an empty class? */
bungeman-skia 2014/05/07 15:33:42 Since the other ones also say something like it,
mtklein 2014/05/07 15:36:44 Done.
+template <typename T>
+class SkTIsEmpty {
+ struct Derived : public T { char unused; };
+public:
+ static const bool value = sizeof(Derived) == sizeof(char);
+};
+
/** Pre-C++11 version of std::true_type. */
typedef SkTBool<true> SkTrue;
« no previous file with comments | « src/record/SkRecord.h ('k') | tests/RecordOptsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698