nana::any bug fix - argument not forwarded

A constructor and an overload of the assignment operator each have a forwarding reference as a parameter, but they don't actually forward the argument.
This commit is contained in:
ErrorFlynn 2019-09-16 06:07:04 -04:00 committed by GitHub
parent b7a0874428
commit e626f816b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -74,7 +74,7 @@ namespace nana
any(Value && value, any(Value && value,
typename std::enable_if<!std::is_same<any&, Value>::value>::type * = nullptr, typename std::enable_if<!std::is_same<any&, Value>::value>::type * = nullptr,
typename std::enable_if<!std::is_const<Value>::value>::type* = nullptr) typename std::enable_if<!std::is_const<Value>::value>::type* = nullptr)
: content_(new holder<typename std::decay<Value>::type>(static_cast<Value&&>(value))) : content_(new holder<typename std::decay<Value>::type>(std::forward<Value>(value)))
{ {
} }
@ -87,7 +87,7 @@ namespace nana
template<class Value> template<class Value>
any& operator=(Value&& other) any& operator=(Value&& other)
{ {
any(other).swap(*this); any(std::forward<Value>(other)).swap(*this);
return *this; return *this;
} }