mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
fixed: deserialization for std::optional<T>
just writing the data does not update the has_value as expected
This commit is contained in:
@@ -617,9 +617,11 @@ void unpack(std::optional<T>&data, std::vector<char>& buffer, int& position,
|
||||
{
|
||||
bool has_value;
|
||||
unpack(has_value, buffer, position, comm);
|
||||
if (has_value)
|
||||
unpack(*data, buffer, position, comm);
|
||||
else
|
||||
if (has_value) {
|
||||
T val;
|
||||
unpack(val, buffer, position, comm);
|
||||
data = std::optional<T>(val);
|
||||
} else
|
||||
data.reset();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user