mirror of
https://github.com/simdjson/simdjson
synced 2026-06-08 17:27:07 +00:00
3c6ef83046
* Trying to correct the documentation so that it actually describes how the code behaves. * tweaking the wording. * Improving. * Removing confusing sentence. * Fixing formatting. * Now with working example, tested. * Added a smaller piece of code
13 lines
484 B
C++
13 lines
484 B
C++
#include <iostream>
|
|
#include "simdjson.h"
|
|
|
|
int main() {
|
|
simdjson::error_code error;
|
|
double value; // variable where we store the value to be parsed
|
|
simdjson::padded_string numberstring = "1.2"_padded; // our JSON input ("1.2")
|
|
simdjson::dom::parser parser;
|
|
parser.parse(numberstring).get<double>().tie(value,error);
|
|
if (error) { std::cerr << error << std::endl; return EXIT_FAILURE; }
|
|
std::cout << "I parsed " << value << " from " << numberstring.data() << std::endl;
|
|
}
|