diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2019-01-16 06:24:57 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2019-01-16 07:49:13 +0100 |
commit | 208ca46200df370ca0b8efc3c6cbd0cde5138195 (patch) | |
tree | 9583797c943645e70ea9e188a7d076b40df08d0a | |
parent | bdbab6bbfef596011302b595cab9b09aec147c55 (diff) |
options/value: add move assignment operators
-rw-r--r-- | options/value.hpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/options/value.hpp b/options/value.hpp index b73b519a..daf87378 100644 --- a/options/value.hpp +++ b/options/value.hpp @@ -96,15 +96,27 @@ public: emit valueChanged(traits::storage_from_value(get())); } - value<u>& operator=(const t& datum) noexcept + value<u>& operator=(t&& datum) noexcept { store_variant(traits::qvariant_from_value(traits::pass_value(datum))); + return *this; + } + value<u>& operator=(const t& datum) noexcept + { + t copy{datum}; + *this = std::move(copy); + return *this; + } + + value<u>& operator=(const value<u>& datum) noexcept + { + *this = *datum; return *this; } - static constexpr inline Qt::ConnectionType DIRECT_CONNTYPE = Qt::DirectConnection; - static constexpr inline Qt::ConnectionType SAFE_CONNTYPE = Qt::QueuedConnection; + static constexpr Qt::ConnectionType DIRECT_CONNTYPE = Qt::DirectConnection; + static constexpr Qt::ConnectionType SAFE_CONNTYPE = Qt::QueuedConnection; value(bundle b, const QString& name, t def) noexcept : value_(b, name), def(std::move(def)) { @@ -122,7 +134,7 @@ public: *this = def; } - operator t() const { return get(); } // NOLINT + operator t() const { return get(); } template<typename w> explicit cc_forceinline operator w() const { return to<w>(); } |