static basic_json array(initializer_list_t init = {});
Creates a JSON array value from a given initializer list. That is, given a list of values a, b, c
, creates the JSON value #!json [a, b, c]
. If the initializer list is empty, the empty array #!json []
is created.
init
(in) : initializer list with JSON values to create an array from (optional)
JSON array value
Strong guarantee: if an exception is thrown, there are no changes in the JSON value.
Linear in the size of init
.
This function is only needed to express two edge cases that cannot be realized with the initializer list constructor (basic_json(initializer_list_t, bool, value_t)
). These cases are:
??? example
The following code shows an example for the `array` function. ```cpp --8<-- "examples/array.cpp" ``` Output: ```json --8<-- "examples/array.output" ```