From 545071e998806235442edda5f575ee61e836abe9 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 3 Jan 2019 00:09:09 +0100 Subject: cruft --- options/value.hpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'options/value.hpp') diff --git a/options/value.hpp b/options/value.hpp index 6714d50d..64234ecf 100644 --- a/options/value.hpp +++ b/options/value.hpp @@ -44,7 +44,7 @@ class value final : public value_ using traits = detail::value_traits; cc_noinline - t get() const + t get() const noexcept { if (self_name.isEmpty() || !b->contains(self_name)) return traits::pass_value(def); @@ -57,7 +57,8 @@ class value final : public value_ return traits::pass_value(traits::value_with_default(traits::value_from_qvariant(variant), def)); } - void store_variant(const QVariant& value) override + cc_noinline + void store_variant(const QVariant& value) noexcept override { if (self_name.isEmpty()) return; @@ -78,7 +79,7 @@ public: emit valueChanged(traits::storage_from_value(get())); } - value& operator=(const t& datum) + value& operator=(const t& datum) noexcept { store_variant(traits::qvariant_from_value(traits::pass_value(datum))); @@ -88,11 +89,12 @@ public: static constexpr inline Qt::ConnectionType DIRECT_CONNTYPE = Qt::DirectConnection; static constexpr inline Qt::ConnectionType SAFE_CONNTYPE = Qt::QueuedConnection; - value(bundle b, const QString& name, t def) : - value_(b, name), def(std::move(def)) + value(bundle b, const QString& name, t def) noexcept : value_(b, name), def(std::move(def)) { } + value(const value& other) noexcept : value{other.b, other.self_name, other.def} {} + t default_value() const { return def; @@ -108,16 +110,16 @@ public: template explicit cc_forceinline operator w() const { return to(); } - auto operator->() const + auto operator->() const noexcept { return detail::dereference_wrapper{get()}; } - cc_forceinline t operator()() const { return get(); } - cc_forceinline t operator*() const { return get(); } + cc_forceinline t operator()() const noexcept { return get(); } + cc_forceinline t operator*() const noexcept { return get(); } template - w to() const + w to() const noexcept { return static_cast(get()); } -- cgit v1.2.3