1 # <small>nlohmann::</small>ordered_map
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>;
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>`).
12 ## Template parameters
21 : comparison function (ignored and only added to ensure compatibility with `#!cpp std::map`)
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>`)
52 The example shows the different behavior of `std::map` and `nlohmann::ordered_map`.
55 --8<-- "examples/ordered_map.cpp"
61 --8<-- "examples/ordered_map.output"
66 - [ordered_json](ordered_json.md)
70 - Added in version 3.9.0 to implement [`nlohmann::ordered_json`](ordered_json.md).