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

Unified Diff: webrtc/base/optional.h

Issue 1570473002: Replace manual casting to rvalue reference with calls to std::move (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.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 | « webrtc/base/buffer.h ('k') | webrtc/base/optional_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/optional.h
diff --git a/webrtc/base/optional.h b/webrtc/base/optional.h
index 6e7535b44600a3713f13e95993b7516de6040e44..b8071e635876b1b42b4bb7d6b6c10b417d25ad7e 100644
--- a/webrtc/base/optional.h
+++ b/webrtc/base/optional.h
@@ -66,20 +66,19 @@ class Optional final {
// Construct an Optional that contains a value.
explicit Optional(const T& val) : value_(val), has_value_(true) {}
- explicit Optional(T&& val)
- : value_(static_cast<T&&>(val)), has_value_(true) {}
+ explicit Optional(T&& val) : value_(std::move(val)), has_value_(true) {}
// Copy and move constructors.
// TODO(kwiberg): =default the move constructor when MSVC supports it.
Optional(const Optional&) = default;
Optional(Optional&& m)
- : value_(static_cast<T&&>(m.value_)), has_value_(m.has_value_) {}
+ : value_(std::move(m.value_)), has_value_(m.has_value_) {}
// Assignment.
// TODO(kwiberg): =default the move assignment op when MSVC supports it.
Optional& operator=(const Optional&) = default;
Optional& operator=(Optional&& m) {
- value_ = static_cast<T&&>(m.value_);
+ value_ = std::move(m.value_);
has_value_ = m.has_value_;
return *this;
}
« no previous file with comments | « webrtc/base/buffer.h ('k') | webrtc/base/optional_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698