I have the following code that works fine on my Windows machine, but not when I'm developing at home on my (M1) Mac. It is for parsing a line in a csv file into floats...
std::stringstream ss("1.0, 2.0, 3.0, 4.0"); // Example line.
std::vector<float> storedValues;
while(ss.good())
{
std::string substring;
std::getline(ss, substring, ',');
float entry = std::stof(substring); // This is where it breaks.
storedValues.push_back(entry);
}
On Windows (Visual Studio 2019) this will compile. On my machine I get the following complaint:
libc++abi: terminating with uncaught exception of type std::invalid_argument: stof: no conversion
terminating with uncaught exception of type std::invalid_argument: stof: no conversion
What is even more strange is that the following WILL work on my XCode setup, no problem:
float test = std::stof("0.1");
So I don't know. What do you think?