From 4120f7f3e071b9682817f4acbd33904ae938be71 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 8 Jul 2018 19:37:37 +0900 Subject: Revert perfect forwarding support in Omittable Turned out to work in unexpected ways when an Omittable<> gets copied. --- lib/util.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'lib/util.h') diff --git a/lib/util.h b/lib/util.h index 4fdf7aa0..aa44893f 100644 --- a/lib/util.h +++ b/lib/util.h @@ -77,12 +77,17 @@ namespace QMatrixClient public: explicit Omittable() : Omittable(none) { } Omittable(NoneTag) : _omitted(true) { } - template - Omittable(TT&& val) : _value(std::forward(val)) { } - template - Omittable& operator=(TT& val) + Omittable(const T& val) : _value(val) { } + Omittable(T&& val) : _value(std::move(val)) { } + Omittable& operator=(const T& val) { - _value = std::forward(val); + _value = val; + _omitted = false; + return *this; + } + Omittable& operator=(T&& val) + { + _value = std::move(val); _omitted = false; return *this; } -- cgit v1.2.3