You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
std::cout << "parsed the number " << result << std::endl;
67
+
if (answer.ec != std::errc()) {
68
+
std::cerr << "parsing failure\n";
69
+
return EXIT_FAILURE;
70
+
}
71
+
std::cout << "parsed the number " << result << '\n';
68
72
return EXIT_SUCCESS;
69
73
}
70
74
```
71
75
72
-
Though the C++17 standard has you do a comparison with `std::errc()` to check whether the conversion worked, you can avoid it by casting the result to a `bool` like so:
76
+
Prior to C++26, checking for a successful `std::from_chars` conversion requires comparing the `from_chars_result::ec` member to `std::errc()`. As an extension `fast_float::from_chars` supports the improved C++26 API that allows checking the result by converting it to `bool`, like so:
0 commit comments