template<class... Args> reference emplace_back(Args&& ... args);
Creates a JSON value from the passed parameters args
to the end of the JSON value. If the function is called on a JSON #!json null
value, an empty array is created before appending the value created from args
.
Args
: compatible types to create a basic_json
object
args
(in) : arguments to forward to a constructor of basic_json
reference to the inserted element
Throws type_error.311
when called on a type other than JSON array or #!json null
; example: "cannot use emplace_back() with number"
Amortized constant.
??? example
The example shows how `emplace_back()` can be used to add elements to a JSON array. Note how the `null` value was silently converted to a JSON array. ```cpp --8<-- "examples/emplace_back.cpp" ``` Output: ```json --8<-- "examples/emplace_back.output" ```