mirror of
https://github.com/USCiLab/cereal.git
synced 2025-10-18 01:45:52 +02:00
Use std::optional::emplace() when loading to construct and load the contained value directly in place
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user