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

Unified Diff: lib/Maybe_h.template

Issue 2468923002: [inspector_protocol] support fall through and moveable Maybe (Closed)
Patch Set: added missing std::move Created 4 years, 1 month 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 | « lib/Forward_h.template ('k') | templates/TypeBuilder_cpp.template » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/Maybe_h.template
diff --git a/lib/Maybe_h.template b/lib/Maybe_h.template
index 2096572ba7ba60a803638aa8aceb2a0e72d88fc6..cd0dfbdf2e10c9e3b52ec0ba7baccf3744481ba9 100644
--- a/lib/Maybe_h.template
+++ b/lib/Maybe_h.template
@@ -16,6 +16,7 @@ class Maybe {
public:
Maybe() : m_value() { }
Maybe(std::unique_ptr<T> value) : m_value(std::move(value)) { }
+ Maybe(Maybe&& other) : m_value(std::move(other.m_value)) { }
void operator=(std::unique_ptr<T> value) { m_value = std::move(value); }
T* fromJust() const { DCHECK(m_value); return m_value.get(); }
T* fromMaybe(T* defaultValue) const { return m_value ? m_value.get() : defaultValue; }
@@ -30,6 +31,7 @@ class MaybeBase {
public:
MaybeBase() : m_isJust(false) { }
MaybeBase(T value) : m_isJust(true), m_value(value) { }
+ MaybeBase(MaybeBase&& other) : m_isJust(other.m_isJust), m_value(std::move(other.m_value)) { }
void operator=(T value) { m_value = value; m_isJust = true; }
T fromJust() const { DCHECK(m_isJust); return m_value; }
T fromMaybe(const T& defaultValue) const { return m_isJust ? m_value : defaultValue; }
@@ -46,6 +48,7 @@ class Maybe<bool> : public MaybeBase<bool> {
public:
Maybe() { }
Maybe(bool value) : MaybeBase(value) { }
+ Maybe(Maybe&& other) : MaybeBase(std::move(other)) { }
using MaybeBase::operator=;
};
@@ -54,6 +57,7 @@ class Maybe<int> : public MaybeBase<int> {
public:
Maybe() { }
Maybe(int value) : MaybeBase(value) { }
+ Maybe(Maybe&& other) : MaybeBase(std::move(other)) { }
using MaybeBase::operator=;
};
@@ -62,6 +66,7 @@ class Maybe<double> : public MaybeBase<double> {
public:
Maybe() { }
Maybe(double value) : MaybeBase(value) { }
+ Maybe(Maybe&& other) : MaybeBase(std::move(other)) { }
using MaybeBase::operator=;
};
@@ -70,6 +75,7 @@ class Maybe<String> : public MaybeBase<String> {
public:
Maybe() { }
Maybe(const String& value) : MaybeBase(value) { }
+ Maybe(Maybe&& other) : MaybeBase(std::move(other)) { }
using MaybeBase::operator=;
};
« no previous file with comments | « lib/Forward_h.template ('k') | templates/TypeBuilder_cpp.template » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698