Files
json/api/basic_json/get_allocator.md
T
2026-10-03 05:43:12 +00:00

903 B

nlohmann::basic_json::get_allocator

static allocator_type get_allocator();

Returns the allocator associated with the container.

Return value

associated allocator

Exception safety

Strong guarantee: if an exception is thrown, there are no changes to any JSON value.

Complexity

Constant.

Examples

??? example

The example shows how `get_allocator()` is used to created `json` values.

```cpp
--8<-- "examples/get_allocator.cpp"
```

Output:

```json
--8<-- "examples/get_allocator.output"
```

See also

Version history

  • Added in version 1.0.0.