Document SIMDJSON_EXCEPTIONS (#1443)

* Document SIMDJSON_EXCEPTIONS

* Add an example

* Enchance clarity
This commit is contained in:
Vadim Peretokin 2021-02-17 20:30:58 +01:00 committed by GitHub
parent 610b3ad302
commit c5def8f706
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -555,6 +555,12 @@ bool parse_string(const char *j, std::string &s) {
}
```
To ensure you don't write any code that uses exceptions, compile with `SIMDJSON_EXCEPTIONS=OFF`. For example, if including the project via cmake:
```cmake
target_compile_definitions(simdjson PUBLIC SIMDJSON_EXCEPTIONS=OFF)
```
### Exceptions
Users more comfortable with an exception flow may choose to directly cast the `simdjson_result<T>` to the desired type: