]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/opentelemetry-cpp/third_party/nlohmann-json/doc/mkdocs/docs/api/ordered_map.md
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / third_party / nlohmann-json / doc / mkdocs / docs / api / ordered_map.md
1 # <small>nlohmann::</small>ordered_map
2
3 ```cpp
4 template<class Key, class T, class IgnoredLess = std::less<Key>,
5 class Allocator = std::allocator<std::pair<const Key, T>>>
6 struct ordered_map : std::vector<std::pair<const Key, T>, Allocator>;
7 ```
8
9 A minimal map-like container that preserves insertion order for use within [`nlohmann::ordered_json`](ordered_json.md)
10 (`nlohmann::basic_json<ordered_map>`).
11
12 ## Template parameters
13
14 `Key`
15 : key type
16
17 `T`
18 : mapped type
19
20 `IgnoredLess`
21 : comparison function (ignored and only added to ensure compatibility with `#!cpp std::map`)
22
23 `Allocator`
24 : allocator type
25
26 ## Member types
27
28 - **key_type** - key type (`Key`)
29 - **mapped_type** - mapped type (`T`)
30 - **Container** - base container type (`#!cpp std::vector<std::pair<const Key, T>, Allocator>`)
31 - **iterator**
32 - **const_iterator**
33 - **size_type**
34 - **value_type**
35
36 ## Member functions
37
38 - (constructor)
39 - (destructor)
40 - **emplace**
41 - **operator\[\]**
42 - **at**
43 - **erase**
44 - **count**
45 - **find**
46 - **insert**
47
48 ## Examples
49
50 ??? example
51
52 The example shows the different behavior of `std::map` and `nlohmann::ordered_map`.
53
54 ```cpp
55 --8<-- "examples/ordered_map.cpp"
56 ```
57
58 Output:
59
60 ```json
61 --8<-- "examples/ordered_map.output"
62 ```
63
64 ## See also
65
66 - [ordered_json](ordered_json.md)
67
68 ## Version history
69
70 - Added in version 3.9.0 to implement [`nlohmann::ordered_json`](ordered_json.md).