Skip to content

Commit 6b52643

Browse files
committed
portability fix
1 parent 7917a30 commit 6b52643

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

benchmarks/benchmark.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ std::vector<TestCase<T>> fileload(const std::string &filename) {
117117
lines.reserve(10000); // let us reserve plenty of memory.
118118
for (std::string line; getline(inputfile, line);) {
119119
T value;
120-
auto [ptr, ec] = std::from_chars(line.data(), line.data() + line.size(), value);
120+
// use fast_float::from_chars to parse the float and not
121+
// std::from_chars since fast_float is always available unlike std::from_chars.
122+
auto [ptr, ec] = fast_float::from_chars(line.data(), line.data() + line.size(), value);
121123
if (ec != std::errc()) {
122124
fmt::println(stderr, "problem with {}\nWe expect floating-point numbers (one per line).", line);
123125
std::abort();

0 commit comments

Comments
 (0)