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

Unified Diff: webrtc/base/maybe.h

Issue 1430433004: Replace rtc::cricket::Settable with rtc::Maybe (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 years, 2 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 | « talk/session/media/channel.cc ('k') | webrtc/base/maybe_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/maybe.h
diff --git a/webrtc/base/maybe.h b/webrtc/base/maybe.h
index df204366d58bf545aaa353e1120df4b24dcb71b4..1df94def3f063709a47d9fdd0244c00c1657fc14 100644
--- a/webrtc/base/maybe.h
+++ b/webrtc/base/maybe.h
@@ -36,10 +36,9 @@ class Maybe final {
// Construct an empty Maybe.
Maybe() : has_value_(false) {}
- // Construct a Maybe that contains a value. Note: These are non-explicit, so
- // that a T will implicitly convert to Maybe<T>.
- Maybe(const T& val) : value_(val), has_value_(true) {}
- Maybe(T&& val) : value_(static_cast<T&&>(val)), has_value_(true) {}
+ // Construct a Maybe that contains a value.
+ explicit Maybe(const T& val) : value_(val), has_value_(true) {}
+ explicit Maybe(T&& val) : value_(static_cast<T&&>(val)), has_value_(true) {}
// Copy and move constructors.
// TODO(kwiberg): =default the move constructor when MSVC supports it.
@@ -47,7 +46,7 @@ class Maybe final {
Maybe(Maybe&& m)
: value_(static_cast<T&&>(m.value_)), has_value_(m.has_value_) {}
- // Assignment. Note that we allow assignment from either Maybe<T> or plain T.
+ // Assignment.
// TODO(kwiberg): =default the move assignment op when MSVC supports it.
Maybe& operator=(const Maybe&) = default;
Maybe& operator=(Maybe&& m) {
@@ -55,16 +54,6 @@ class Maybe final {
has_value_ = m.has_value_;
return *this;
}
- Maybe& operator=(const T& val) {
- value_ = val;
- has_value_ = true;
- return *this;
- }
- Maybe& operator=(T&& val) {
- value_ = static_cast<T&&>(val);
- has_value_ = true;
- return *this;
- }
friend void swap(Maybe& m1, Maybe& m2) {
using std::swap;
« no previous file with comments | « talk/session/media/channel.cc ('k') | webrtc/base/maybe_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698