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

Unified Diff: include/private/SkTLogic.h

Issue 1273813002: Add skstd::move and skstd::forward. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Don't need to change animator anymore. Created 5 years, 4 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 | « include/private/SkFunction.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/private/SkTLogic.h
diff --git a/include/private/SkTLogic.h b/include/private/SkTLogic.h
index d188242446d0345af89e2fdc45da86de7c49f45f..2710d6d1cf77f71c123c997d077cb6bacce0d4a9 100644
--- a/include/private/SkTLogic.h
+++ b/include/private/SkTLogic.h
@@ -18,6 +18,8 @@
#ifndef SkTLogic_DEFINED
#define SkTLogic_DEFINED
+#include <stdint.h>
+
/** Represents a templated integer constant.
* Pre-C++11 version of std::integral_constant.
*/
@@ -108,4 +110,29 @@ public: \
static const bool value = sizeof(func<T>(NULL)) == sizeof(uint8_t); \
}
+namespace skstd {
+
+/** SkTRemoveReference<T>::type is the type of T with any top-level lvalue or rvalue removed. */
+template <typename T> struct remove_reference { typedef T type; };
+template <typename T> struct remove_reference<T&> { typedef T type; };
+template <typename T> struct remove_reference<T&&> { typedef T type; };
+template <typename T> using remove_reference_t = typename remove_reference<T>::type;
+
+/** SkTIsLValueReference<T>::value is true if the type T is an lvalue reference. */
+template <typename T> struct is_lvalue_reference : SkFalse {};
+template <typename T> struct is_lvalue_reference<T&> : SkTrue {};
+
+} // namespace skstd
+
+/**
+ * SkTIsConst<T>::value is true if the type T is const.
+ * The type T is constrained not to be an array or reference type.
+ */
+template <typename T> struct SkTIsConst {
+ static T* t;
+ static uint16_t test(const volatile void*);
+ static uint32_t test(volatile void *);
+ static const bool value = (sizeof(uint16_t) == sizeof(test(t)));
+};
+
#endif
« no previous file with comments | « include/private/SkFunction.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698