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

Unified Diff: include/private/SkTLogic.h

Issue 1555153002: Add skstd::remove_pointer_t and use it. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 12 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 | « no previous file | src/ports/SkFontMgr_android_parser.cpp » ('j') | 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 9c21db6756877ea0791165cb91608bc7c0fc85f5..181d2a1b01f9ab258e6a8f87b7de8096d63b35ab 100644
--- a/include/private/SkTLogic.h
+++ b/include/private/SkTLogic.h
@@ -59,6 +59,11 @@ template <typename T> struct remove_reference<T&> { using type = T; };
template <typename T> struct remove_reference<T&&> { using type = T; };
template <typename T> using remove_reference_t = typename remove_reference<T>::type;
+template <typename T, typename T_cv> struct remove_pointer_no_cv { using type = T; };
mtklein 2016/01/05 02:41:00 Can't we use std::remove_ptr, then build skstd::re
bungeman-skia 2016/01/06 16:25:16 Yes, but doing so would mean fixing all the other
+template <typename T, typename T_cv> struct remove_pointer_no_cv<T, T_cv*> { using type = T_cv; };
+template <typename T> struct remove_pointer : remove_pointer_no_cv<T, remove_cv_t<T>> {};
+template <typename T> using remove_pointer_t = typename remove_pointer<T>::type;
+
template <typename T> struct remove_extent { using type = T; };
template <typename T> struct remove_extent<T[]> { using type = T; };
template <typename T, size_t N> struct remove_extent<T[N]> { using type = T;};
@@ -115,7 +120,7 @@ template <typename T, size_t N> struct is_array<T[N]> : true_type {};
// R [calling-convention] (Args...[, ...]) [const] [volatile] [&|&&]> : true_type {};
// The cv and ref-qualified versions are strange types we're currently avoiding, so not supported.
// On all platforms, variadic functions only exist in the c calling convention.
-template <typename> struct is_function : false_type { };
+template <typename> struct is_function : false_type {};
#if !defined(SK_BUILD_FOR_WIN)
template <typename R, typename... Args> struct is_function<R(Args...)> : true_type {};
#else
@@ -147,7 +152,7 @@ template <typename T> using add_pointer_t = typename add_pointer<T>::type;
template <typename T, bool=is_void<T>::value> struct add_lvalue_reference_init { using type = T; };
template <typename T> struct add_lvalue_reference_init<T, false> { using type = T&; };
-template <typename T> struct add_lvalue_reference : add_lvalue_reference_init<T> { };
+template <typename T> struct add_lvalue_reference : add_lvalue_reference_init<T> {};
template <typename T> using add_lvalue_reference_t = typename add_lvalue_reference<T>::type;
template <typename T, bool=is_void<T>::value> struct add_rvalue_reference_init { using type = T; };
@@ -176,7 +181,7 @@ template <typename S, typename D> struct is_convertible_detector<S, D, false> {
static const/*expr*/ bool value = sizeof(convertible<S, D>(0)) == sizeof(yes_type);
};
template<typename S, typename D> struct is_convertible
- : bool_constant<is_convertible_detector<S, D>::value> { };
+ : bool_constant<is_convertible_detector<S, D>::value> {};
template <typename T> struct decay {
using U = remove_reference_t<T>;
« no previous file with comments | « no previous file | src/ports/SkFontMgr_android_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698