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
Copy file name to clipboardExpand all lines: doc/basics.md
+33-4Lines changed: 33 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,9 +39,9 @@ You can compile with:
39
39
c++ myproject.cpp simdjson.cpp
40
40
```
41
41
42
-
Note:
42
+
Note:
43
43
- Users on macOS and other platforms were default compilers do not provide C++11 compliant by default should request it with the appropriate flag (e.g., `c++ myproject.cpp simdjson.cpp`).
44
-
- Visual Studio users should compile with the `_CRT_SECURE_NO_WARNINGS` flag to avoid warnings with respect to our use of standard C functions such as `fopen`.
44
+
- Visual Studio users should compile with the `_CRT_SECURE_NO_WARNINGS` flag to avoid warnings with respect to our use of standard C functions such as `fopen`.
45
45
46
46
47
47
The Basics: Loading and Parsing JSON Documents
@@ -95,8 +95,8 @@ Once you have an element, you can navigate it with idiomatic C++ iterators, oper
95
95
* **Array Index:** To get at an array value by index, use the at() method: `array.at(0)` gets the
96
96
first element.
97
97
> Note that array[0] does not compile, because implementing [] gives the impression indexing is a
98
-
> O(1) operation, which it is not presently in simdjson. Instead, you should iterate over the elements
99
-
> using a for-loop, as in our examples.
98
+
> O(1) operation, which it is not presently in simdjson. Instead, you should iterate over the elements
99
+
> using a for-loop, as in our examples.
100
100
* **Array and Object size** Given an array or an object, you can get its size (number of elements or keys)
101
101
with the `size()` method.
102
102
* **Checking an Element Type:** You can check an element's type with `element.type()`. It
@@ -399,6 +399,35 @@ And another one:
399
399
400
400
Notice how we can string several operation (`parser.parse(abstract_json)["str"]["123"]["abc"].get<double>()`) and only check for the error once, a strategy we call *error chaining*.
401
401
402
+
403
+
The next two functions will take as input a JSON document containing an array with a single element, either a string or a number. They return true upon success.
0 commit comments