Fix optional::operator=

This commit is contained in:
yvt 2019-07-20 13:42:34 +09:00
parent 9e770cc040
commit 464b88a23b
No known key found for this signature in database
GPG Key ID: 48F2768FA8D07C92

View File

@ -85,15 +85,19 @@ namespace stmp {
void operator=(const optional &o) {
if (has_some && o.has_some) {
**this = *o;
} else {
} else if (o.has_some) {
reset(*o);
} else {
reset();
}
}
void operator=(optional &&o) {
if (has_some && o.has_some) {
**this = *std::move(o);
} else {
} else if (o.has_some) {
reset(*std::move(o));
} else {
reset();
}
}