any: makes assign work for all basic_any types

This commit is contained in:
Michele Caini
2022-05-25 16:46:50 +02:00
parent 92c2fd9409
commit d59407a339

View File

@@ -323,7 +323,7 @@ public:
* @param other The value to assign to the contained object.
* @return True in case of success, false otherwise.
*/
bool assign(const any &other) {
bool assign(const basic_any &other) {
if(vtable && mode != policy::cref && *info == *other.info) {
return (vtable(operation::assign, *this, other.data()) != nullptr);
}
@@ -332,7 +332,7 @@ public:
}
/*! @copydoc assign */
bool assign(any &&other) {
bool assign(basic_any &&other) {
if(vtable && mode != policy::cref && *info == *other.info) {
if(auto *val = other.data(); val) {
return (vtable(operation::transfer, *this, val) != nullptr);