mirror of
https://github.com/okalachev/flix.git
synced 2025-08-16 08:36:06 +00:00
Fix storing nans and infs in preferences in simulator
Turns out file streams cannot parse nans and infs on some platforms, so use std::stof to parse.
This commit is contained in:
@@ -14,10 +14,9 @@ private:
|
||||
|
||||
void readFromFile() {
|
||||
std::ifstream file(storagePath);
|
||||
std::string key;
|
||||
float value;
|
||||
std::string key, value;
|
||||
while (file >> key >> value) {
|
||||
storage[key] = value;
|
||||
storage[key] = std::stof(value); // using stof to support NaN and Infinity
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user