File: emplace_back.md

package info (click to toggle)
jsoncons 1.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 17,584 kB
  • sloc: cpp: 136,382; sh: 33; makefile: 5
file content (35 lines) | stat: -rw-r--r-- 503 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
### jsoncons::basic_json::emplace_back
```cpp
template <typename... Args>
json& emplace_back(Args&&... args);
```

#### Parameters

    args 
Arguments to forward to the constructor of the json value

#### Return value

A reference to the emplaced json value.

#### Exceptions

Throws `std::domain_error` if not a json array.

### Example

```cpp
json arr(json_array_arg);
arr.emplace_back(10);
arr.emplace_back(20);
arr.emplace_back(30);

std::cout << arr << '\n';
```
Output:

```json
[10,20,30]
```