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

Unified Diff: include/private/SkUniquePtr.h

Issue 1561683002: Start using <type_traits> and <utility> (C++11). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix skstd::unique_ptr::compressed_pair. 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 | « include/private/SkTemplates.h ('k') | include/private/SkUtility.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/private/SkUniquePtr.h
diff --git a/include/private/SkUniquePtr.h b/include/private/SkUniquePtr.h
index 5d6e7226580aed5b176d7bd050cea8caa5bd5b78..a8246398550fc6a6232230554bd7432136976705 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 <cstddef>
+#include <utility>
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 <typename U1, typename U2, typename = enable_if_t<
is_convertible<U1, pointer>::value && is_convertible<U2, deleter_type>::value
>> /*constexpr*/ compressed_data(U1&& ptr, U2&& d)
- : compressed_base<deleter_type>(skstd::forward<U2>(d)), fPtr(skstd::forward<U1>(ptr)) {}
+ : compressed_base<deleter_type>(std::forward<U2>(d)), fPtr(std::forward<U1>(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<deleter_type>::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<deleter_type>::value, "Deleter is nullptr function pointer!");
@@ -108,7 +109,7 @@ public:
{}
unique_ptr(pointer ptr, remove_reference_t<deleter_type>&& d) /*noexcept*/
- : data(move(ptr), move(d))
+ : data(std::move(ptr), std::move(d))
{
static_assert(!is_reference<deleter_type>::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<deleter_type>(that.get_deleter()))
+ : data(that.release(), std::forward<deleter_type>(that.get_deleter()))
{}
template <typename U, typename ThatD, typename = enable_if_t<
@@ -124,7 +125,7 @@ public:
!is_array<U>::value &&
conditional_t<is_reference<D>::value, is_same<ThatD, D>, is_convertible<ThatD, D>>::value>>
unique_ptr(unique_ptr<U, ThatD>&& that) /*noexcept*/
- : data(that.release(), forward<ThatD>(that.get_deleter()))
+ : data(that.release(), std::forward<ThatD>(that.get_deleter()))
{}
~unique_ptr() /*noexcept*/ {
@@ -137,7 +138,7 @@ public:
unique_ptr& operator=(unique_ptr&& that) /*noexcept*/ {
reset(that.release());
- get_deleter() = forward<deleter_type>(that.get_deleter());
+ get_deleter() = std::forward<deleter_type>(that.get_deleter());
return *this;
}
@@ -146,11 +147,11 @@ public:
!is_array<U>::value,
unique_ptr&> operator=(unique_ptr<U, ThatD>&& that) /*noexcept*/ {
reset(that.release());
- get_deleter() = forward<ThatD>(that.get_deleter());
+ get_deleter() = std::forward<ThatD>(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 <typename U1, typename U2, typename = enable_if_t<
is_convertible<U1, pointer>::value && is_convertible<U2, deleter_type>::value
>> /*constexpr*/ compressed_data(U1&& ptr, U2&& d)
- : compressed_base<deleter_type>(skstd::forward<U2>(d)), fPtr(skstd::forward<U1>(ptr)) {}
+ : compressed_base<deleter_type>(std::forward<U2>(d)), fPtr(std::forward<U1>(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<deleter_type>::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<deleter_type>::value, "Deleter is nullptr function pointer!");
@@ -278,14 +279,14 @@ public:
{}
unique_ptr(pointer ptr, remove_reference_t<deleter_type>&& d) /*noexcept*/
- : data(move(ptr), move(d))
+ : data(std::move(ptr), std::move(d))
{
static_assert(!is_reference<deleter_type>::value,
"Binding an rvalue reference deleter as an lvalue reference deleter is not allowed.");
}
unique_ptr(unique_ptr&& that) /*noexcept*/
- : data(that.release(), forward<deleter_type>(that.get_deleter()))
+ : data(that.release(), std::forward<deleter_type>(that.get_deleter()))
{}
~unique_ptr() {
@@ -298,11 +299,11 @@ public:
unique_ptr& operator=(unique_ptr&& that) /*noexcept*/ {
reset(that.release());
- get_deleter() = forward<deleter_type>(that.get_deleter());
+ get_deleter() = std::forward<deleter_type>(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<T, D>& a, const unique_ptr<U, ThatD>& b)
}
template <typename T, typename D>
-inline bool operator==(const unique_ptr<T, D>& a, skstd::nullptr_t) /*noexcept*/ {
+inline bool operator==(const unique_ptr<T, D>& a, std::nullptr_t) /*noexcept*/ {
//return !a;
return !a.is_attached();
}
template <typename T, typename D>
-inline bool operator==(skstd::nullptr_t, const unique_ptr<T, D>& b) /*noexcept*/ {
+inline bool operator==(std::nullptr_t, const unique_ptr<T, D>& b) /*noexcept*/ {
//return !b;
return !b.is_attached();
}
@@ -380,13 +381,13 @@ inline bool operator!=(const unique_ptr<T, D>& a, const unique_ptr<U, ThatD>& b)
}
template <typename T, typename D>
-inline bool operator!=(const unique_ptr<T, D>& a, skstd::nullptr_t) /*noexcept*/ {
+inline bool operator!=(const unique_ptr<T, D>& a, std::nullptr_t) /*noexcept*/ {
//return (bool)a;
return a.is_attached();
}
template <typename T, typename D>
-inline bool operator!=(skstd::nullptr_t, const unique_ptr<T, D>& b) /*noexcept*/ {
+inline bool operator!=(std::nullptr_t, const unique_ptr<T, D>& b) /*noexcept*/ {
//return (bool)b;
return b.is_attached();
}
« no previous file with comments | « include/private/SkTemplates.h ('k') | include/private/SkUtility.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698