Use std::optional::emplace() when loading to construct and load the contained value directly in place

This commit is contained in:
logan
2021-09-17 11:09:39 -07:00
committed by Shane Grant
parent 0bbbb142f9
commit f8338dbb73
+2 -3
View File
@@ -56,9 +56,8 @@ namespace cereal {
if (nullopt) {
optional = std::nullopt;
} else {
T value;
ar(CEREAL_NVP_("data", value));
optional = std::move(value);
optional.emplace();
ar(CEREAL_NVP_("data", *optional));
}
}
} // namespace cereal