diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-07-08 19:37:37 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-07-08 19:37:37 +0900 |
commit | 4120f7f3e071b9682817f4acbd33904ae938be71 (patch) | |
tree | c042b568c0e73123c39b9c7d9c6173d95824eaa9 /lib | |
parent | 08a3c52134cfc3458a86c2fc238f9a20a04e0c3c (diff) | |
download | libquotient-4120f7f3e071b9682817f4acbd33904ae938be71.tar.gz libquotient-4120f7f3e071b9682817f4acbd33904ae938be71.zip |
Revert perfect forwarding support in Omittable
Turned out to work in unexpected ways when an Omittable<> gets copied.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/util.h | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -77,12 +77,17 @@ namespace QMatrixClient public: explicit Omittable() : Omittable(none) { } Omittable(NoneTag) : _omitted(true) { } - template <typename TT> - Omittable(TT&& val) : _value(std::forward<TT>(val)) { } - template <typename TT> - Omittable<T>& operator=(TT& val) + Omittable(const T& val) : _value(val) { } + Omittable(T&& val) : _value(std::move(val)) { } + Omittable<T>& operator=(const T& val) { - _value = std::forward<TT>(val); + _value = val; + _omitted = false; + return *this; + } + Omittable<T>& operator=(T&& val) + { + _value = std::move(val); _omitted = false; return *this; } |