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=; |
}; |