From 221524de3be1fc343ad328c5e99562f32b5cad9c Mon Sep 17 00:00:00 2001 From: bungeman Date: Tue, 5 Jan 2016 14:59:40 -0800 Subject: [PATCH] Start using and (C++11). SkUtility.h and SkTLogic.h implement a number of type traits now available through and . This removes SkUtility.h, replacing it with , and moves a number of traits in SkTLogic.h to use the std:: equivelents. This change only uses C++11 parts of the standard library; SkTLogic.h will continue to provide C++14 and beyond for now in the skstd namespace. The changes to SkTLogic.h are being done gradually so that safe changes may be landed confidently, with more risky changes in the future. Review URL: https://codereview.chromium.org/1561683002 --- gyp/core.gypi | 1 - include/core/SkTArray.h | 3 +- include/core/SkTLazy.h | 3 +- include/private/SkTLogic.h | 138 +++++++----------- include/private/SkTemplates.h | 1 - include/private/SkUniquePtr.h | 47 +++--- include/private/SkUtility.h | 32 ---- src/animator/SkMemberInfo.h | 5 +- src/core/SkDraw.cpp | 1 - src/core/SkFindAndPlaceGlyph.h | 9 +- src/gpu/effects/GrPorterDuffXferProcessor.cpp | 3 +- src/pdf/SkPDFMetadata.cpp | 9 +- src/utils/SkTFitsIn.h | 11 +- tests/CPlusPlusEleven.cpp | 17 ++- tools/BUILD.public.expected | 1 - 15 files changed, 107 insertions(+), 174 deletions(-) delete mode 100644 include/private/SkUtility.h diff --git a/gyp/core.gypi b/gyp/core.gypi index 9be95429f3..04f74fe593 100644 --- a/gyp/core.gypi +++ b/gyp/core.gypi @@ -411,7 +411,6 @@ '<(skia_include_path)/private/SkTSearch.h', '<(skia_include_path)/private/SkTLogic.h', '<(skia_include_path)/private/SkUniquePtr.h', - '<(skia_include_path)/private/SkUtility.h', '<(skia_include_path)/private/SkWeakRefCnt.h', # Path ops diff --git a/include/core/SkTArray.h b/include/core/SkTArray.h index 9f1bfa1ac1..17cbc5c05c 100644 --- a/include/core/SkTArray.h +++ b/include/core/SkTArray.h @@ -12,6 +12,7 @@ #include "SkTypes.h" #include +#include template class SkTArray; @@ -198,7 +199,7 @@ public: */ template T& emplace_back(Args&&... args) { T* newT = reinterpret_cast(this->push_back_raw(1)); - return *new (newT) T(skstd::forward(args)...); + return *new (newT) T(std::forward(args)...); } /** diff --git a/include/core/SkTLazy.h b/include/core/SkTLazy.h index 60d816147f..c8ae3178f7 100644 --- a/include/core/SkTLazy.h +++ b/include/core/SkTLazy.h @@ -11,6 +11,7 @@ #include "../private/SkTemplates.h" #include "SkTypes.h" #include +#include /** * Efficient way to defer allocating/initializing a class until it is needed @@ -50,7 +51,7 @@ public: if (this->isValid()) { fPtr->~T(); } - fPtr = new (SkTCast(fStorage.get())) T(skstd::forward(args)...); + fPtr = new (SkTCast(fStorage.get())) T(std::forward(args)...); return fPtr; } diff --git a/include/private/SkTLogic.h b/include/private/SkTLogic.h index 9c21db6756..8d07ba1d38 100644 --- a/include/private/SkTLogic.h +++ b/include/private/SkTLogic.h @@ -5,9 +5,10 @@ * found in the LICENSE file. * * - * This header provides some of the helpers (std::integral_constant) and - * type transformations (std::conditional) which will become available with - * C++11 in the type_traits header. + * This header provides some of the helpers (like std::enable_if_t) which will + * become available with C++14 in the type_traits header (in the skstd + * namespace). This header also provides several Skia specific additions such + * as SK_WHEN and the sknonstd namespace. */ #ifndef SkTLogic_DEFINED @@ -17,77 +18,46 @@ #include #include +#include +#include namespace skstd { -using nullptr_t = decltype(nullptr); +template using bool_constant = std::integral_constant; -template struct integral_constant { - static const/*expr*/ T value = v; - using value_type = T; - using type = integral_constant; - //constexpr operator value_type() const noexcept { return value; } - //constexpr value_type operator()() const noexcept { return value; } -}; +template using conditional_t = typename std::conditional::type; +template using enable_if_t = typename std::enable_if::type; -template using bool_constant = integral_constant; +template using remove_const_t = typename std::remove_const::type; +template using remove_volatile_t = typename std::remove_volatile::type; +template using remove_cv_t = typename std::remove_cv::type; +template using remove_reference_t = typename std::remove_reference::type; +template using remove_extent_t = typename std::remove_extent::type; -using true_type = bool_constant; -using false_type = bool_constant; - -template struct conditional { using type = T; }; -template struct conditional { using type = F; }; -template using conditional_t = typename conditional::type; - -template struct enable_if { using type = T; }; -template struct enable_if {}; -template using enable_if_t = typename enable_if::type; - -template struct remove_const { using type = T; }; -template struct remove_const { using type = T; }; -template using remove_const_t = typename remove_const::type; - -template struct remove_volatile { using type = T; }; -template struct remove_volatile { using type = T; }; -template using remove_volatile_t = typename remove_volatile::type; - -template struct remove_cv { using type = remove_volatile_t>; }; -template using remove_cv_t = typename remove_cv::type; - -template struct remove_reference { using type = T; }; -template struct remove_reference { using type = T; }; -template struct remove_reference { using type = T; }; -template using remove_reference_t = typename remove_reference::type; - -template struct remove_extent { using type = T; }; -template struct remove_extent { using type = T; }; -template struct remove_extent { using type = T;}; -template using remove_extent_t = typename remove_extent::type; - -template struct is_same : false_type {}; -template struct is_same : true_type {}; +template struct is_same : std::false_type {}; +template struct is_same : std::true_type {}; template struct is_void : is_same> {}; -template struct is_const : false_type {}; -template struct is_const : true_type {}; +template struct is_const : std::false_type {}; +template struct is_const : std::true_type {}; -template struct is_volatile : false_type {}; -template struct is_volatile : true_type {}; +template struct is_volatile : std::false_type {}; +template struct is_volatile : std::true_type {}; -template struct is_pointer_detector : false_type {}; -template struct is_pointer_detector : true_type {}; +template struct is_pointer_detector : std::false_type {}; +template struct is_pointer_detector : std::true_type {}; template struct is_pointer : is_pointer_detector> {}; -template struct is_reference : false_type {}; -template struct is_reference : true_type {}; -template struct is_reference : true_type {}; +template struct is_reference : std::false_type {}; +template struct is_reference : std::true_type {}; +template struct is_reference : std::true_type {}; -template struct is_lvalue_reference : false_type {}; -template struct is_lvalue_reference : true_type {}; +template struct is_lvalue_reference : std::false_type {}; +template struct is_lvalue_reference : std::true_type {}; -template struct is_rvalue_reference : false_type {}; -template struct is_rvalue_reference : true_type {}; +template struct is_rvalue_reference : std::false_type {}; +template struct is_rvalue_reference : std::true_type {}; template struct is_class_detector { using yes_type = uint8_t; @@ -107,47 +77,40 @@ template struct is_empty_detector { }; template struct is_empty : bool_constant::value> {}; -template struct is_array : false_type {}; -template struct is_array : true_type {}; -template struct is_array : true_type {}; +template struct is_array : std::false_type {}; +template struct is_array : std::true_type {}; +template struct is_array : std::true_type {}; // template struct is_function< -// R [calling-convention] (Args...[, ...]) [const] [volatile] [&|&&]> : true_type {}; +// 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. // On all platforms, variadic functions only exist in the c calling convention. -template struct is_function : false_type { }; +template struct is_function : std::false_type {}; #if !defined(SK_BUILD_FOR_WIN) -template struct is_function : true_type {}; +template struct is_function : std::true_type {}; #else #if defined(_M_IX86) -template struct is_function : true_type {}; -template struct is_function : true_type {}; -template struct is_function : true_type {}; +template struct is_function : std::true_type {}; +template struct is_function : std::true_type {}; +template struct is_function : std::true_type {}; #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 -template struct is_function : true_type {}; +template struct is_function : std::true_type {}; #endif #else -template struct is_function : true_type {}; -template struct is_function : true_type {}; +template struct is_function : std::true_type {}; +template struct is_function : std::true_type {}; #endif #endif -template struct is_function : true_type {}; +template struct is_function : std::true_type {}; -template struct add_const { using type = const T; }; -template using add_const_t = typename add_const::type; - -template struct add_volatile { using type = volatile T; }; -template using add_volatile_t = typename add_volatile::type; - -template struct add_cv { using type = add_volatile_t>; }; -template using add_cv_t = typename add_cv::type; - -template struct add_pointer { using type = remove_reference_t*; }; -template using add_pointer_t = typename add_pointer::type; +template using add_const_t = typename std::add_const::type; +template using add_volatile_t = typename std::add_volatile::type; +template using add_cv_t = typename std::add_cv::type; +template using add_pointer_t = typename std::add_pointer::type; template ::value> struct add_lvalue_reference_init { using type = T; }; template struct add_lvalue_reference_init { using type = T&; }; -template struct add_lvalue_reference : add_lvalue_reference_init { }; +template struct add_lvalue_reference : add_lvalue_reference_init {}; template using add_lvalue_reference_t = typename add_lvalue_reference::type; template ::value> struct add_rvalue_reference_init { using type = T; }; @@ -155,9 +118,6 @@ template struct add_rvalue_reference_init { using type = template struct add_rvalue_reference : add_rvalue_reference_init {}; template using add_rvalue_reference_t = typename add_rvalue_reference::type; -/* This is 'just' a forward declaration. */ -template add_rvalue_reference_t declval() /*noexcept*/; - template ::value||is_function::value||is_array::value> struct is_convertible_detector { static const/*expr*/ bool value = is_void::value; @@ -169,14 +129,14 @@ template struct is_convertible_detector { template static void param_convertable_to(To); template - static decltype(param_convertable_to(declval()), yes_type()) convertible(int); + static decltype(param_convertable_to(std::declval()), yes_type()) convertible(int); template static no_type convertible(...); static const/*expr*/ bool value = sizeof(convertible(0)) == sizeof(yes_type); }; template struct is_convertible - : bool_constant::value> { }; + : bool_constant::value> {}; template struct decay { using U = remove_reference_t; diff --git a/include/private/SkTemplates.h b/include/private/SkTemplates.h index c1fd4cbca6..496cf42733 100644 --- a/include/private/SkTemplates.h +++ b/include/private/SkTemplates.h @@ -14,7 +14,6 @@ #include "SkTLogic.h" #include "SkTypes.h" #include "SkUniquePtr.h" -#include "SkUtility.h" #include #include diff --git a/include/private/SkUniquePtr.h b/include/private/SkUniquePtr.h index 5d6e722658..a824639855 100644 --- a/include/private/SkUniquePtr.h +++ b/include/private/SkUniquePtr.h @@ -9,7 +9,8 @@ #define SkUniquePtr_DEFINED #include "SkTLogic.h" -#include "SkUtility.h" +#include +#include namespace skstd { @@ -51,7 +52,7 @@ private: struct compressed_base : private B { /*constexpr*/ compressed_base() : B() {} /*constexpr*/ compressed_base(const B& b) : B(b) {} - /*constexpr*/ compressed_base(const B&& b) : B(move(b)) {} + /*constexpr*/ compressed_base(B&& b) : B(std::move(b)) {} /*constexpr*/ B& get() /*noexcept*/ { return *this; } /*constexpr*/ B const& get() const /*noexcept*/ { return *this; } void swap(compressed_base&) /*noexcept*/ { } @@ -61,7 +62,7 @@ private: B fb; /*constexpr*/ compressed_base() : B() {} /*constexpr*/ compressed_base(const B& b) : fb(b) {} - /*constexpr*/ compressed_base(const B&& b) : fb(move(b)) {} + /*constexpr*/ compressed_base(B&& b) : fb(std::move(b)) {} /*constexpr*/ B& get() /*noexcept*/ { return fb; } /*constexpr*/ B const& get() const /*noexcept*/ { return fb; } void swap(compressed_base& that) /*noexcept*/ { SkTSwap(fb, that.fB); } @@ -75,7 +76,7 @@ private: template ::value && is_convertible::value >> /*constexpr*/ compressed_data(U1&& ptr, U2&& d) - : compressed_base(skstd::forward(d)), fPtr(skstd::forward(ptr)) {} + : compressed_base(std::forward(d)), fPtr(std::forward(ptr)) {} /*constexpr*/ pointer& getPointer() /*noexcept*/ { return fPtr; } /*constexpr*/ pointer const& getPointer() const /*noexcept*/ { return fPtr; } /*constexpr*/ deleter_type& getDeleter() /*noexcept*/ { @@ -96,7 +97,7 @@ public: static_assert(!is_pointer::value, "Deleter is nullptr function pointer!"); } - /*constexpr*/ unique_ptr(skstd::nullptr_t) /*noexcept*/ : unique_ptr() { } + /*constexpr*/ unique_ptr(std::nullptr_t) /*noexcept*/ : unique_ptr() { } explicit unique_ptr(pointer ptr) /*noexcept*/ : data(ptr, deleter_type()) { static_assert(!is_pointer::value, "Deleter is nullptr function pointer!"); @@ -108,7 +109,7 @@ public: {} unique_ptr(pointer ptr, remove_reference_t&& d) /*noexcept*/ - : data(move(ptr), move(d)) + : data(std::move(ptr), std::move(d)) { static_assert(!is_reference::value, "Binding an rvalue reference deleter as an lvalue reference deleter is not allowed."); @@ -116,7 +117,7 @@ public: unique_ptr(unique_ptr&& that) /*noexcept*/ - : data(that.release(), forward(that.get_deleter())) + : data(that.release(), std::forward(that.get_deleter())) {} template ::value && conditional_t::value, is_same, is_convertible>::value>> unique_ptr(unique_ptr&& that) /*noexcept*/ - : data(that.release(), forward(that.get_deleter())) + : data(that.release(), std::forward(that.get_deleter())) {} ~unique_ptr() /*noexcept*/ { @@ -137,7 +138,7 @@ public: unique_ptr& operator=(unique_ptr&& that) /*noexcept*/ { reset(that.release()); - get_deleter() = forward(that.get_deleter()); + get_deleter() = std::forward(that.get_deleter()); return *this; } @@ -146,11 +147,11 @@ public: !is_array::value, unique_ptr&> operator=(unique_ptr&& that) /*noexcept*/ { reset(that.release()); - get_deleter() = forward(that.get_deleter()); + get_deleter() = std::forward(that.get_deleter()); return *this; } - unique_ptr& operator=(skstd::nullptr_t) /*noexcept*/ { + unique_ptr& operator=(std::nullptr_t) /*noexcept*/ { reset(); return *this; } @@ -221,7 +222,7 @@ private: struct compressed_base : private B { /*constexpr*/ compressed_base() : B() {} /*constexpr*/ compressed_base(const B& b) : B(b) {} - /*constexpr*/ compressed_base(const B&& b) : B(move(b)) {} + /*constexpr*/ compressed_base(B&& b) : B(std::move(b)) {} /*constexpr*/ B& get() /*noexcept*/ { return *this; } /*constexpr*/ B const& get() const /*noexcept*/ { return *this; } void swap(compressed_base&) /*noexcept*/ { } @@ -231,7 +232,7 @@ private: B fb; /*constexpr*/ compressed_base() : B() {} /*constexpr*/ compressed_base(const B& b) : fb(b) {} - /*constexpr*/ compressed_base(const B&& b) : fb(move(b)) {} + /*constexpr*/ compressed_base(B&& b) : fb(std::move(b)) {} /*constexpr*/ B& get() /*noexcept*/ { return fb; } /*constexpr*/ B const& get() const /*noexcept*/ { return fb; } void swap(compressed_base& that) /*noexcept*/ { SkTSwap(fb, that.fB); } @@ -245,7 +246,7 @@ private: template ::value && is_convertible::value >> /*constexpr*/ compressed_data(U1&& ptr, U2&& d) - : compressed_base(skstd::forward(d)), fPtr(skstd::forward(ptr)) {} + : compressed_base(std::forward(d)), fPtr(std::forward(ptr)) {} /*constexpr*/ pointer& getPointer() /*noexcept*/ { return fPtr; } /*constexpr*/ pointer const& getPointer() const /*noexcept*/ { return fPtr; } /*constexpr*/ deleter_type& getDeleter() /*noexcept*/ { @@ -266,7 +267,7 @@ public: static_assert(!is_pointer::value, "Deleter is nullptr function pointer!"); } - /*constexpr*/ unique_ptr(skstd::nullptr_t) /*noexcept*/ : unique_ptr() { } + /*constexpr*/ unique_ptr(std::nullptr_t) /*noexcept*/ : unique_ptr() { } explicit unique_ptr(pointer ptr) /*noexcept*/ : data(ptr, deleter_type()) { static_assert(!is_pointer::value, "Deleter is nullptr function pointer!"); @@ -278,14 +279,14 @@ public: {} unique_ptr(pointer ptr, remove_reference_t&& d) /*noexcept*/ - : data(move(ptr), move(d)) + : data(std::move(ptr), std::move(d)) { static_assert(!is_reference::value, "Binding an rvalue reference deleter as an lvalue reference deleter is not allowed."); } unique_ptr(unique_ptr&& that) /*noexcept*/ - : data(that.release(), forward(that.get_deleter())) + : data(that.release(), std::forward(that.get_deleter())) {} ~unique_ptr() { @@ -298,11 +299,11 @@ public: unique_ptr& operator=(unique_ptr&& that) /*noexcept*/ { reset(that.release()); - get_deleter() = forward(that.get_deleter()); + get_deleter() = std::forward(that.get_deleter()); return *this; } - unique_ptr& operator=(skstd::nullptr_t) /*noexcept*/ { + unique_ptr& operator=(std::nullptr_t) /*noexcept*/ { reset(); return *this; } @@ -363,13 +364,13 @@ inline bool operator==(const unique_ptr& a, const unique_ptr& b) } template -inline bool operator==(const unique_ptr& a, skstd::nullptr_t) /*noexcept*/ { +inline bool operator==(const unique_ptr& a, std::nullptr_t) /*noexcept*/ { //return !a; return !a.is_attached(); } template -inline bool operator==(skstd::nullptr_t, const unique_ptr& b) /*noexcept*/ { +inline bool operator==(std::nullptr_t, const unique_ptr& b) /*noexcept*/ { //return !b; return !b.is_attached(); } @@ -380,13 +381,13 @@ inline bool operator!=(const unique_ptr& a, const unique_ptr& b) } template -inline bool operator!=(const unique_ptr& a, skstd::nullptr_t) /*noexcept*/ { +inline bool operator!=(const unique_ptr& a, std::nullptr_t) /*noexcept*/ { //return (bool)a; return a.is_attached(); } template -inline bool operator!=(skstd::nullptr_t, const unique_ptr& b) /*noexcept*/ { +inline bool operator!=(std::nullptr_t, const unique_ptr& b) /*noexcept*/ { //return (bool)b; return b.is_attached(); } diff --git a/include/private/SkUtility.h b/include/private/SkUtility.h deleted file mode 100644 index a96e8fe292..0000000000 --- a/include/private/SkUtility.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkUtility_DEFINED -#define SkUtility_DEFINED - -#include "SkTLogic.h" - -namespace skstd { - -template inline remove_reference_t&& move(T&& t) { - return static_cast&&>(t); -} - -template inline T&& forward(remove_reference_t& t) /*noexcept*/ { - return static_cast(t); -} -template inline T&& forward(remove_reference_t&& t) /*noexcept*/ { - static_assert(!is_lvalue_reference::value, - "Forwarding an rvalue reference as an lvalue reference is not allowed."); - return static_cast(t); -} - -template add_rvalue_reference_t declval(); - -} // namespace skstd - -#endif diff --git a/src/animator/SkMemberInfo.h b/src/animator/SkMemberInfo.h index b62de663d4..709d66ac84 100644 --- a/src/animator/SkMemberInfo.h +++ b/src/animator/SkMemberInfo.h @@ -18,6 +18,7 @@ #include "SkScript.h" #include "SkString.h" #include "SkIntArray.h" +#include class SkAnimateMaker; class SkDisplayable; @@ -111,11 +112,11 @@ struct SkMemberInfo { #define SK_MEMBER(_member, _type) \ { #_member, SK_OFFSETOF(BASE_CLASS, _member), SkType_##_type, \ - sizeof(skstd::declval()._member) / sizeof(SkScalar) } + sizeof(std::declval()._member) / sizeof(SkScalar) } #define SK_MEMBER_ALIAS(_member, _alias, _type) \ { #_member, SK_OFFSETOF(BASE_CLASS, _alias), SkType_##_type, \ - sizeof(skstd::declval()._alias) / sizeof(SkScalar) } + sizeof(std::declval()._alias) / sizeof(SkScalar) } #define SK_MEMBER_ARRAY(_member, _type) \ { #_member, SK_OFFSETOF(BASE_CLASS, _member), SkType_Array, \ diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp index 883359ca59..249795d0d1 100644 --- a/src/core/SkDraw.cpp +++ b/src/core/SkDraw.cpp @@ -30,7 +30,6 @@ #include "SkTemplates.h" #include "SkTextMapStateProc.h" #include "SkTLazy.h" -#include "SkUtility.h" #include "SkUtils.h" #include "SkVertState.h" diff --git a/src/core/SkFindAndPlaceGlyph.h b/src/core/SkFindAndPlaceGlyph.h index bd6338d587..c74a9820e4 100644 --- a/src/core/SkFindAndPlaceGlyph.h +++ b/src/core/SkFindAndPlaceGlyph.h @@ -14,6 +14,7 @@ #include "SkPaint.h" #include "SkTemplates.h" #include "SkUtils.h" +#include // Calculate a type with the same size as the max of all the Ts. // This must be top level because the is no specialization of inner classes. @@ -91,7 +92,7 @@ private: #define alignof __alignof #endif SkASSERT(alignof(Variant) <= alignof(Space)); - new(&fSpace) Variant(skstd::forward(args)...); + new(&fSpace) Variant(std::forward(args)...); } private: @@ -609,7 +610,7 @@ inline void SkFindAndPlaceGlyph::ProcessPosText( SkPoint mappedPoint = mapper.TranslationMapper::map( positions.HorizontalPositions::nextPoint()); positioner.Positioner::findAndPositionGlyph( - &cursor, mappedPoint, skstd::forward(processOneGlyph)); + &cursor, mappedPoint, std::forward(processOneGlyph)); } return; } @@ -681,7 +682,7 @@ inline void SkFindAndPlaceGlyph::ProcessPosText( while (text < stop) { SkPoint mappedPoint = mapper->map(positionReader->nextPoint()); findAndPosition->findAndPositionGlyph( - &text, mappedPoint, skstd::forward(processOneGlyph)); + &text, mappedPoint, std::forward(processOneGlyph)); } } @@ -725,7 +726,7 @@ inline void SkFindAndPlaceGlyph::ProcessText( while (text < stop) { current = findAndPosition->findAndPositionGlyph( - &text, current, skstd::forward(processOneGlyph)); + &text, current, std::forward(processOneGlyph)); } } diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.cpp b/src/gpu/effects/GrPorterDuffXferProcessor.cpp index 11af4b6aa0..94d3dd67a9 100644 --- a/src/gpu/effects/GrPorterDuffXferProcessor.cpp +++ b/src/gpu/effects/GrPorterDuffXferProcessor.cpp @@ -19,6 +19,7 @@ #include "glsl/GrGLSLProgramDataManager.h" #include "glsl/GrGLSLUniformHandler.h" #include "glsl/GrGLSLXferProcessor.h" +#include /** * Wraps the shader outputs and HW blend state that comprise a Porter Duff blend mode with coverage. @@ -71,7 +72,7 @@ public: */ template - struct get_properties : skstd::integral_constant( + struct get_properties : std::integral_constant( (GR_BLEND_MODIFIES_DST(BlendEquation, SrcCoeff, DstCoeff) ? kModifiesDst_Property : 0) | diff --git a/src/pdf/SkPDFMetadata.cpp b/src/pdf/SkPDFMetadata.cpp index 3f181f5d73..51619c6748 100644 --- a/src/pdf/SkPDFMetadata.cpp +++ b/src/pdf/SkPDFMetadata.cpp @@ -7,6 +7,7 @@ #include "SkPDFMetadata.h" #include "SkPDFTypes.h" +#include #ifdef SK_PDF_GENERATE_PDFA #include "SkMD5.h" @@ -117,7 +118,7 @@ static SkString sk_string_printf(const char* format, ...) { va_end(args); SkASSERT(check == length); SkASSERT(string[length] == '\0'); - return skstd::move(string); + return std::move(string); #else // C99/C++11 standard vsnprintf // TODO: When all compilers support this, remove windows-specific code. va_list args; @@ -138,7 +139,7 @@ static SkString sk_string_printf(const char* format, ...) { va_end(args); SkASSERT(check == length); SkASSERT(string[length] == '\0'); - return skstd::move(string); + return std::move(string); #endif } @@ -185,7 +186,7 @@ static SkString uuid_to_string(const SkPDFMetadata::UUID& uuid) { namespace { class PDFXMLObject final : public SkPDFObject { public: - PDFXMLObject(SkString xml) : fXML(skstd::move(xml)) {} + PDFXMLObject(SkString xml) : fXML(std::move(xml)) {} void emitObject(SkWStream* stream, const SkPDFObjNumMap& omap, const SkPDFSubstituteMap& smap) const override { @@ -258,7 +259,7 @@ const SkString escape_xml(const SkString& input, // Validate that we haven't written outside of our string. SkASSERT(out == &output.writable_str()[output.size()]); *out = '\0'; - return skstd::move(output); + return std::move(output); } SkPDFObject* SkPDFMetadata::createXMPObject(const UUID& doc, diff --git a/src/utils/SkTFitsIn.h b/src/utils/SkTFitsIn.h index cf92822d8f..fc2b8dd630 100644 --- a/src/utils/SkTFitsIn.h +++ b/src/utils/SkTFitsIn.h @@ -11,6 +11,7 @@ #include "SkTypes.h" #include "SkTLogic.h" #include +#include namespace sktfitsin { namespace Private { @@ -31,7 +32,7 @@ template struct SkTHasMoreDigits * that source values are in the range of the Destination. */ template struct SkTOutOfRange_False { - typedef skstd::false_type can_be_true; + typedef std::false_type can_be_true; typedef S source_type; static bool apply(S s) { return false; @@ -42,7 +43,7 @@ template struct SkTOutOfRange_False { * Assumes that Min(S) <= Min(D). */ template struct SkTOutOfRange_LT_MinD { - typedef skstd::true_type can_be_true; + typedef std::true_type can_be_true; typedef S source_type; static bool apply(S s) { typedef SkTHasMoreDigits precondition; @@ -54,7 +55,7 @@ template struct SkTOutOfRange_LT_MinD { /** A low side predicate which tests if the source value is less than 0. */ template struct SkTOutOfRange_LT_Zero { - typedef skstd::true_type can_be_true; + typedef std::true_type can_be_true; typedef S source_type; static bool apply(S s) { return s < static_cast(0); @@ -65,7 +66,7 @@ template struct SkTOutOfRange_LT_Zero { * Assumes that Max(S) >= Max(D). */ template struct SkTOutOfRange_GT_MaxD { - typedef skstd::true_type can_be_true; + typedef std::true_type can_be_true; typedef S source_type; static bool apply(S s) { typedef SkTHasMoreDigits precondition; @@ -79,7 +80,7 @@ template struct SkTOutOfRange_GT_MaxD { * First checks OutOfRange_Low then, if in range, OutOfRange_High. */ template struct SkTOutOfRange_Either { - typedef skstd::true_type can_be_true; + typedef std::true_type can_be_true; typedef typename OutOfRange_Low::source_type source_type; static bool apply(source_type s) { bool outOfRange = OutOfRange_Low::apply(s); diff --git a/tests/CPlusPlusEleven.cpp b/tests/CPlusPlusEleven.cpp index 5c2123dc47..0cd2e937b2 100644 --- a/tests/CPlusPlusEleven.cpp +++ b/tests/CPlusPlusEleven.cpp @@ -6,6 +6,7 @@ */ #include "Test.h" #include "SkTemplates.h" +#include namespace { class Moveable { @@ -24,8 +25,8 @@ template struct Deleter { } // namespace DEF_TEST(CPlusPlusEleven_RvalueAndMove, r) { - Moveable src1; Moveable dst1(skstd::move(src1)); - Moveable src2, dst2; dst2 = skstd::move(src2); + Moveable src1; Moveable dst1(std::move(src1)); + Moveable src2, dst2; dst2 = std::move(src2); } #define TOO_BIG "The unique_ptr was bigger than expected." @@ -51,7 +52,7 @@ DEF_TEST(CPlusPlusEleven_UniquePtr, r) { skstd::unique_ptr u(nullptr, deleter); static_assert(sizeof(u) == sizeof(BigUniquePtr), WEIRD_SIZE); - auto u2 = skstd::move(u); + auto u2 = std::move(u); static_assert(sizeof(u2) == sizeof(BigUniquePtr), WEIRD_SIZE); } @@ -59,7 +60,7 @@ DEF_TEST(CPlusPlusEleven_UniquePtr, r) { skstd::unique_ptr u(nullptr, [](Moveable* m){ deleter(m); }); static_assert(sizeof(u) == sizeof(BigUniquePtr), WEIRD_SIZE); - auto u2 = skstd::move(u); + auto u2 = std::move(u); static_assert(sizeof(u2) == sizeof(BigUniquePtr), WEIRD_SIZE); } @@ -68,7 +69,7 @@ DEF_TEST(CPlusPlusEleven_UniquePtr, r) { skstd::unique_ptr u(nullptr, d); static_assert(sizeof(u) == sizeof(SmallUniquePtr), TOO_BIG); - auto u2 = skstd::move(u); + auto u2 = std::move(u); static_assert(sizeof(u2) == sizeof(SmallUniquePtr), TOO_BIG); } @@ -76,7 +77,7 @@ DEF_TEST(CPlusPlusEleven_UniquePtr, r) { skstd::unique_ptr> u(nullptr, Deleter()); static_assert(sizeof(u) == sizeof(SmallUniquePtr), TOO_BIG); - auto u2 = skstd::move(u); + auto u2 = std::move(u); static_assert(sizeof(u2) == sizeof(SmallUniquePtr), TOO_BIG); } @@ -84,7 +85,7 @@ DEF_TEST(CPlusPlusEleven_UniquePtr, r) { skstd::unique_ptr> u(new Moveable(), Deleter()); static_assert(sizeof(u) == sizeof(SmallUniquePtr), TOO_BIG); - auto u2 = skstd::move(u); + auto u2 = std::move(u); static_assert(sizeof(u2) == sizeof(SmallUniquePtr), TOO_BIG); } @@ -92,7 +93,7 @@ DEF_TEST(CPlusPlusEleven_UniquePtr, r) { skstd::unique_ptr> u(new Moveable(), Deleter()); static_assert(sizeof(u) == sizeof(SmallUniquePtr), TOO_BIG); - auto u2 = skstd::move(u); + auto u2 = std::move(u); static_assert(sizeof(u2) == sizeof(SmallUniquePtr), TOO_BIG); } } diff --git a/tools/BUILD.public.expected b/tools/BUILD.public.expected index e41605ca54..de6edf5e7e 100644 --- a/tools/BUILD.public.expected +++ b/tools/BUILD.public.expected @@ -292,7 +292,6 @@ BASE_SRCS = ['include/private/SkAtomics.h', 'include/private/SkTemplates.h', 'include/private/SkThreadID.h', 'include/private/SkUniquePtr.h', - 'include/private/SkUtility.h', 'include/private/SkWeakRefCnt.h', 'src/android/SkBitmapRegionCanvas.cpp', 'src/android/SkBitmapRegionCanvas.h',