OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 * | 6 * |
7 * | 7 * |
8 * This header provides some of the helpers (like std::enable_if_t) which will | 8 * This header provides some of the helpers (like std::enable_if_t) which will |
9 * become available with C++14 in the type_traits header (in the skstd | 9 * become available with C++14 in the type_traits header (in the skstd |
10 * namespace). This header also provides several Skia specific additions such | 10 * namespace). This header also provides several Skia specific additions such |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 #endif | 55 #endif |
56 #endif | 56 #endif |
57 template <typename R, typename... Args> struct is_function<R(Args..., ...)> : st
d::true_type {}; | 57 template <typename R, typename... Args> struct is_function<R(Args..., ...)> : st
d::true_type {}; |
58 | 58 |
59 template <typename T> using add_const_t = typename std::add_const<T>::type; | 59 template <typename T> using add_const_t = typename std::add_const<T>::type; |
60 template <typename T> using add_volatile_t = typename std::add_volatile<T>::type
; | 60 template <typename T> using add_volatile_t = typename std::add_volatile<T>::type
; |
61 template <typename T> using add_cv_t = typename std::add_cv<T>::type; | 61 template <typename T> using add_cv_t = typename std::add_cv<T>::type; |
62 template <typename T> using add_pointer_t = typename std::add_pointer<T>::type; | 62 template <typename T> using add_pointer_t = typename std::add_pointer<T>::type; |
63 template <typename T> using add_lvalue_reference_t = typename std::add_lvalue_re
ference<T>::type; | 63 template <typename T> using add_lvalue_reference_t = typename std::add_lvalue_re
ference<T>::type; |
64 | 64 |
| 65 template <typename... T> using common_type_t = typename std::common_type<T...>::
type; |
| 66 |
65 template <typename S, typename D, | 67 template <typename S, typename D, |
66 bool=std::is_void<S>::value || is_function<D>::value || std::is_array<
D>::value> | 68 bool=std::is_void<S>::value || is_function<D>::value || std::is_array<
D>::value> |
67 struct is_convertible_detector { | 69 struct is_convertible_detector { |
68 static const/*expr*/ bool value = std::is_void<D>::value; | 70 static const/*expr*/ bool value = std::is_void<D>::value; |
69 }; | 71 }; |
70 template <typename S, typename D> struct is_convertible_detector<S, D, false> { | 72 template <typename S, typename D> struct is_convertible_detector<S, D, false> { |
71 using yes_type = uint8_t; | 73 using yes_type = uint8_t; |
72 using no_type = uint16_t; | 74 using no_type = uint16_t; |
73 | 75 |
74 template <typename To> static void param_convertable_to(To); | 76 template <typename To> static void param_convertable_to(To); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 template <typename D, typename S> using same_volatile_t = typename same_volatile
<D, S>::type; | 120 template <typename D, typename S> using same_volatile_t = typename same_volatile
<D, S>::type; |
119 template <typename D, typename S> using same_cv = copy_cv<skstd::remove_cv_t<D>,
S>; | 121 template <typename D, typename S> using same_cv = copy_cv<skstd::remove_cv_t<D>,
S>; |
120 template <typename D, typename S> using same_cv_t = typename same_cv<D, S>::type
; | 122 template <typename D, typename S> using same_cv_t = typename same_cv<D, S>::type
; |
121 | 123 |
122 } // namespace sknonstd | 124 } // namespace sknonstd |
123 | 125 |
124 // Just a pithier wrapper for enable_if_t. | 126 // Just a pithier wrapper for enable_if_t. |
125 #define SK_WHEN(condition, T) skstd::enable_if_t<!!(condition), T> | 127 #define SK_WHEN(condition, T) skstd::enable_if_t<!!(condition), T> |
126 | 128 |
127 #endif | 129 #endif |
OLD | NEW |