template<class Key, class T, class IgnoredLess = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T>>> struct ordered_map : std::vector<std::pair<const Key, T>, Allocator>;
A minimal map-like container that preserves insertion order for use within nlohmann::ordered_json
(nlohmann::basic_json<ordered_map>
).
Key
: key type
T
: mapped type
IgnoredLess
: comparison function (ignored and only added to ensure compatibility with #!cpp std::map
)
Allocator
: allocator type
Key
)T
)#!cpp std::vector<std::pair<const Key, T>, Allocator>
)??? example
The example shows the different behavior of `std::map` and `nlohmann::ordered_map`. ```cpp --8<-- "examples/ordered_map.cpp" ``` Output: ```json --8<-- "examples/ordered_map.output" ```
nlohmann::ordered_json
.