From 208ca46200df370ca0b8efc3c6cbd0cde5138195 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 16 Jan 2019 06:24:57 +0100 Subject: options/value: add move assignment operators --- options/value.hpp | 20 ++++++++++++++++---- 1 file 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& operator=(const t& datum) noexcept + value& operator=(t&& datum) noexcept { store_variant(traits::qvariant_from_value(traits::pass_value(datum))); + return *this; + } + value& operator=(const t& datum) noexcept + { + t copy{datum}; + *this = std::move(copy); + return *this; + } + + value& operator=(const value& 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 explicit cc_forceinline operator w() const { return to(); } -- cgit v1.2.3