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

Unified Diff: include/private/SkTLogic.h

Issue 1565283003: More <type_traits> for SkTLogic.h. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 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 | include/private/SkUniquePtr.h » ('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 0ca0d0f11bc1e53b562059f0a89f59293811569a..022ba746ba8f08c8f7301e8d97dc00baaaa147f9 100644
--- a/include/private/SkTLogic.h
+++ b/include/private/SkTLogic.h
@@ -35,37 +35,13 @@ template <typename T> using remove_pointer_t = typename std::remove_pointer<T>::
template <typename T> using remove_reference_t = typename std::remove_reference<T>::type;
template <typename T> using remove_extent_t = typename std::remove_extent<T>::type;
-template <typename T, typename U> struct is_same : std::false_type {};
-template <typename T> struct is_same<T, T> : std::true_type {};
-
-template <typename T> struct is_void : is_same<void, remove_cv_t<T>> {};
-
-template <typename T> struct is_const : std::false_type {};
-template <typename T> struct is_const<const T> : std::true_type {};
-
-template <typename T> struct is_volatile : std::false_type {};
-template <typename T> struct is_volatile<volatile T> : std::true_type {};
-
-template <typename T> struct is_pointer_detector : std::false_type {};
-template <typename T> struct is_pointer_detector<T*> : std::true_type {};
-template <typename T> struct is_pointer : is_pointer_detector<remove_cv_t<T>> {};
-
-template <typename T> struct is_reference : std::false_type {};
-template <typename T> struct is_reference<T&> : std::true_type {};
-template <typename T> struct is_reference<T&&> : std::true_type {};
-
-template <typename T> struct is_lvalue_reference : std::false_type {};
-template <typename T> struct is_lvalue_reference<T&> : std::true_type {};
-
-template <typename T> struct is_rvalue_reference : std::false_type {};
-template <typename T> struct is_rvalue_reference<T&&> : std::true_type {};
-
template <typename T> struct is_class_detector {
using yes_type = uint8_t;
using no_type = uint16_t;
template <typename U> static yes_type clazz(int U::*);
template <typename U> static no_type clazz(...);
- static const/*expr*/ bool value = sizeof(clazz<T>(0)) == sizeof(yes_type) /*&& !is_union<T>::value*/;
+ static const/*expr*/ bool value = sizeof(clazz<T>(0)) == sizeof(yes_type) &&
+ !std::is_union<T>::value;
};
template <typename T> struct is_class : bool_constant<is_class_detector<T>::value> {};
@@ -78,10 +54,6 @@ template <typename T> struct is_empty_detector<T, false> {
};
template <typename T> struct is_empty : bool_constant<is_empty_detector<T>::value> {};
-template <typename T> struct is_array : std::false_type {};
-template <typename T> struct is_array<T[]> : std::true_type {};
-template <typename T, size_t N> struct is_array<T[N]> : std::true_type {};
-
// template<typename R, typename... Args> struct is_function<
// R [calling-convention] (Args...[, ...]) [const] [volatile] [&|&&]> : std::true_type {};
// The cv and ref-qualified versions are strange types we're currently avoiding, so not supported.
@@ -109,19 +81,20 @@ template <typename T> using add_volatile_t = typename std::add_volatile<T>::type
template <typename T> using add_cv_t = typename std::add_cv<T>::type;
template <typename T> using add_pointer_t = typename std::add_pointer<T>::type;
-template <typename T, bool=is_void<T>::value> struct add_lvalue_reference_init { using type = T; };
+template <typename T, bool=std::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> 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; };
+template <typename T, bool=std::is_void<T>::value> struct add_rvalue_reference_init { using type = T; };
template <typename T> struct add_rvalue_reference_init<T, false> { using type = T&&; };
template <typename T> struct add_rvalue_reference : add_rvalue_reference_init<T> {};
template <typename T> using add_rvalue_reference_t = typename add_rvalue_reference<T>::type;
-template <typename S, typename D, bool=is_void<S>::value||is_function<D>::value||is_array<D>::value>
+template <typename S, typename D,
+ bool=std::is_void<S>::value || is_function<D>::value || std::is_array<D>::value>
struct is_convertible_detector {
- static const/*expr*/ bool value = is_void<D>::value;
+ static const/*expr*/ bool value = std::is_void<D>::value;
};
template <typename S, typename D> struct is_convertible_detector<S, D, false> {
using yes_type = uint8_t;
@@ -141,9 +114,11 @@ template<typename S, typename D> struct is_convertible
template <typename T> struct decay {
using U = remove_reference_t<T>;
- using type = conditional_t<is_array<U>::value,
- remove_extent_t<U>*,
- conditional_t<is_function<U>::value, add_pointer_t<U>, remove_cv_t<U>>>;
+ using type = conditional_t<std::is_array<U>::value,
+ remove_extent_t<U>*,
+ conditional_t<is_function<U>::value,
+ add_pointer_t<U>,
+ remove_cv_t<U>>>;
};
template <typename T> using decay_t = typename decay<T>::type;
@@ -157,12 +132,12 @@ namespace sknonstd {
// std::experimental::propagate_const already exists for other purposes in TSv2.
// These also follow the <dest, source> pattern used by boost.
template <typename D, typename S> struct copy_const {
- using type = skstd::conditional_t<skstd::is_const<S>::value, skstd::add_const_t<D>, D>;
+ using type = skstd::conditional_t<std::is_const<S>::value, skstd::add_const_t<D>, D>;
};
template <typename D, typename S> using copy_const_t = typename copy_const<D, S>::type;
template <typename D, typename S> struct copy_volatile {
- using type = skstd::conditional_t<skstd::is_volatile<S>::value, skstd::add_volatile_t<D>, D>;
+ using type = skstd::conditional_t<std::is_volatile<S>::value, skstd::add_volatile_t<D>, D>;
};
template <typename D, typename S> using copy_volatile_t = typename copy_volatile<D, S>::type;
« no previous file with comments | « no previous file | include/private/SkUniquePtr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698