| 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 15 matching lines...) Expand all Loading... |
| 26 template <bool B, typename T, typename F> using conditional_t = typename std::co
nditional<B, T, F>::type; | 26 template <bool B, typename T, typename F> using conditional_t = typename std::co
nditional<B, T, F>::type; |
| 27 template <bool B, typename T = void> using enable_if_t = typename std::enable_if
<B, T>::type; | 27 template <bool B, typename T = void> using enable_if_t = typename std::enable_if
<B, T>::type; |
| 28 | 28 |
| 29 template <typename T> using remove_const_t = typename std::remove_const<T>::type
; | 29 template <typename T> using remove_const_t = typename std::remove_const<T>::type
; |
| 30 template <typename T> using remove_volatile_t = typename std::remove_volatile<T>
::type; | 30 template <typename T> using remove_volatile_t = typename std::remove_volatile<T>
::type; |
| 31 template <typename T> using remove_cv_t = typename std::remove_cv<T>::type; | 31 template <typename T> using remove_cv_t = typename std::remove_cv<T>::type; |
| 32 template <typename T> using remove_pointer_t = typename std::remove_pointer<T>::
type; | 32 template <typename T> using remove_pointer_t = typename std::remove_pointer<T>::
type; |
| 33 template <typename T> using remove_reference_t = typename std::remove_reference<
T>::type; | 33 template <typename T> using remove_reference_t = typename std::remove_reference<
T>::type; |
| 34 template <typename T> using remove_extent_t = typename std::remove_extent<T>::ty
pe; | 34 template <typename T> using remove_extent_t = typename std::remove_extent<T>::ty
pe; |
| 35 | 35 |
| 36 // template<typename R, typename... Args> struct is_function< | |
| 37 // R [calling-convention] (Args...[, ...]) [const] [volatile] [&|&&]> : std:
:true_type {}; | |
| 38 // The cv and ref-qualified versions are strange types we're currently avoiding,
so not supported. | |
| 39 // These aren't supported in msvc either until vs2015u2. | |
| 40 // On all platforms, variadic functions only exist in the c calling convention. | |
| 41 // mcvc 2013 introduced __vectorcall, but it wan't until 2015 that it was added
to is_function. | |
| 42 template <typename> struct is_function : std::false_type {}; | |
| 43 #if !defined(WIN32) | |
| 44 template <typename R, typename... Args> struct is_function<R(Args...)> : std::tr
ue_type {}; | |
| 45 #else | |
| 46 template <typename R, typename... Args> struct is_function<R __cdecl (Args...)>
: std::true_type {}; | |
| 47 #if defined(_M_IX86) | |
| 48 template <typename R, typename... Args> struct is_function<R __stdcall (Args...)
> : std::true_type {}; | |
| 49 template <typename R, typename... Args> struct is_function<R __fastcall (Args...
)> : std::true_type {}; | |
| 50 #endif | |
| 51 #if defined(_MSC_VER) && (_M_IX86_FP >= 2 || defined(_M_AMD64) || defined(_M_X64
)) | |
| 52 template <typename R, typename... Args> struct is_function<R __vectorcall (Args.
..)> : std::true_type {}; | |
| 53 #endif | |
| 54 #endif | |
| 55 template <typename R, typename... Args> struct is_function<R(Args..., ...)> : st
d::true_type {}; | |
| 56 | |
| 57 template <typename T> using add_const_t = typename std::add_const<T>::type; | 36 template <typename T> using add_const_t = typename std::add_const<T>::type; |
| 58 template <typename T> using add_volatile_t = typename std::add_volatile<T>::type
; | 37 template <typename T> using add_volatile_t = typename std::add_volatile<T>::type
; |
| 59 template <typename T> using add_cv_t = typename std::add_cv<T>::type; | 38 template <typename T> using add_cv_t = typename std::add_cv<T>::type; |
| 60 template <typename T> using add_pointer_t = typename std::add_pointer<T>::type; | 39 template <typename T> using add_pointer_t = typename std::add_pointer<T>::type; |
| 61 template <typename T> using add_lvalue_reference_t = typename std::add_lvalue_re
ference<T>::type; | 40 template <typename T> using add_lvalue_reference_t = typename std::add_lvalue_re
ference<T>::type; |
| 62 | 41 |
| 63 template <typename... T> using common_type_t = typename std::common_type<T...>::
type; | 42 template <typename... T> using common_type_t = typename std::common_type<T...>::
type; |
| 64 | 43 |
| 65 // Chromium currently requires gcc 4.8.2 or a recent clang compiler, but uses li
bstdc++4.6.4. | 44 // Chromium currently requires gcc 4.8.2 or a recent clang compiler, but uses li
bstdc++4.6.4. |
| 66 // Note that Precise actually uses libstdc++4.6.3. | 45 // Note that Precise actually uses libstdc++4.6.3. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 template <typename D, typename S> using same_volatile_t = typename same_volatile
<D, S>::type; | 95 template <typename D, typename S> using same_volatile_t = typename same_volatile
<D, S>::type; |
| 117 template <typename D, typename S> using same_cv = copy_cv<skstd::remove_cv_t<D>,
S>; | 96 template <typename D, typename S> using same_cv = copy_cv<skstd::remove_cv_t<D>,
S>; |
| 118 template <typename D, typename S> using same_cv_t = typename same_cv<D, S>::type
; | 97 template <typename D, typename S> using same_cv_t = typename same_cv<D, S>::type
; |
| 119 | 98 |
| 120 } // namespace sknonstd | 99 } // namespace sknonstd |
| 121 | 100 |
| 122 // Just a pithier wrapper for enable_if_t. | 101 // Just a pithier wrapper for enable_if_t. |
| 123 #define SK_WHEN(condition, T) skstd::enable_if_t<!!(condition), T> | 102 #define SK_WHEN(condition, T) skstd::enable_if_t<!!(condition), T> |
| 124 | 103 |
| 125 #endif | 104 #endif |
| OLD | NEW |