Updating the README example.

This commit is contained in:
Daniel Lemire 2020-10-27 14:42:36 -04:00
parent 5970251026
commit 88705b6ede
2 changed files with 3 additions and 1 deletions

View File

@ -35,7 +35,7 @@ The implementation does not throw and does not allocate memory (e.g., with `new`
Example: Example:
``` C++ ``` C++
#include "fast_float/parse_number.h" #include "fast_float/fast_float.h"
#include <iostream> #include <iostream>
int main() { int main() {
@ -44,6 +44,7 @@ int main() {
auto answer = fast_float::from_chars(input.data(), input.data()+input.size(), result); auto answer = fast_float::from_chars(input.data(), input.data()+input.size(), result);
if(answer.ec != std::errc()) { std::cerr << "parsing failure\n"; return EXIT_FAILURE; } if(answer.ec != std::errc()) { std::cerr << "parsing failure\n"; return EXIT_FAILURE; }
std::cout << "parsed the number " << result << std::endl; std::cout << "parsed the number " << result << std::endl;
return EXIT_SUCCESS;
} }
``` ```

View File

@ -8,4 +8,5 @@ int main() {
auto answer = fast_float::from_chars(input.data(), input.data()+input.size(), result); auto answer = fast_float::from_chars(input.data(), input.data()+input.size(), result);
if(answer.ec != std::errc()) { std::cerr << "parsing failure\n"; return EXIT_FAILURE; } if(answer.ec != std::errc()) { std::cerr << "parsing failure\n"; return EXIT_FAILURE; }
std::cout << "parsed the number " << result << std::endl; std::cout << "parsed the number " << result << std::endl;
return EXIT_SUCCESS;
} }