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

Unified Diff: include/private/SkTemplates.h

Issue 1317593004: Clean up SkTLogic. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove no longer true comment. 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/SkTLogic.h ('k') | src/core/SkRecord.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/private/SkTemplates.h
diff --git a/include/private/SkTemplates.h b/include/private/SkTemplates.h
index afab0ef207233a437372c718d3bd99d430518326..cfeb76d29ef0b72a991fc3e41d876c60058ba6bd 100644
--- a/include/private/SkTemplates.h
+++ b/include/private/SkTemplates.h
@@ -47,16 +47,6 @@ template <typename T> add_rvalue_reference_t<T> declval();
} // namespace skstd
-///@{
-/** SkTConstType<T, CONST>::type will be 'const T' if CONST is true, 'T' otherwise. */
-template <typename T, bool CONST> struct SkTConstType {
- typedef T type;
-};
-template <typename T> struct SkTConstType<T, true> {
- typedef const T type;
-};
-///@}
-
/**
* Returns a pointer to a D which comes immediately after S[count].
*/
@@ -68,11 +58,9 @@ template <typename D, typename S> static D* SkTAfter(S* ptr, size_t count = 1) {
* Returns a pointer to a D which comes byteOffset bytes after S.
*/
template <typename D, typename S> static D* SkTAddOffset(S* ptr, size_t byteOffset) {
- // The intermediate char* has the same const-ness as D as this produces better error messages.
+ // The intermediate char* has the same cv-ness as D as this produces better error messages.
// This relies on the fact that reinterpret_cast can add constness, but cannot remove it.
- return reinterpret_cast<D*>(
- reinterpret_cast<typename SkTConstType<char, SkTIsConst<D>::value>::type*>(ptr) + byteOffset
- );
+ return reinterpret_cast<D*>(reinterpret_cast<sknonstd::same_cv_t<char, D>*>(ptr) + byteOffset);
}
/** \class SkAutoTCallVProc
« no previous file with comments | « include/private/SkTLogic.h ('k') | src/core/SkRecord.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698