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

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: singletons 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') | no next file » | 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..2b5df0b16fe866559a846790ae1ecef380cfda38 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> { };
+/** Pre-C++11 version of std::is_empty<T>. */
+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') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698