[#nlohmann-ordered_map] = xref:nlohmann.adoc[nlohmann]::ordered_map :relfileprefix: ../ :mrdocs: a minimal map‐like container that preserves insertion order == Synopsis Declared in `<nlohmann/ordered_map.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class Key, class T, class IgnoredLess = std::less<Key>, class Allocator = std::allocator<std::pair<Key const, T>>> struct ordered_map : std::vector<std::pair<Key const, T>, Allocator> ---- == Description ordered_map: a minimal map‐like container that preserves insertion order for use within nlohmann::basic_json<ordered_map> == Base Classes [cols="1,4"] |=== | Name| Description | `std::vector<std::pair<Key const, T>, Allocator>` | A standard container which offers fixed time access to individual elements in any order. |=== == Type Aliases [cols="1,4"] |=== | Name| Description | xref:nlohmann/ordered_map/Container.adoc[`Container`] | the underlying container type used to store the key‐value pairs | xref:nlohmann/ordered_map/const_iterator.adoc[`const_iterator`] | a const iterator over the underlying container | xref:nlohmann/ordered_map/iterator.adoc[`iterator`] | an iterator over the underlying container | xref:nlohmann/ordered_map/key_compare.adoc[`key_compare`] | the comparison function used to determine whether two keys are equal | xref:nlohmann/ordered_map/key_type.adoc[`key_type`] | the type of the keys stored in the map | xref:nlohmann/ordered_map/mapped_type.adoc[`mapped_type`] | the type of the values mapped to each key | xref:nlohmann/ordered_map/require_input_iter.adoc[`require_input_iter`] | helper type that is only defined if _InputIt_ qualifies as an input iterator, used to constrain the iterator‐range overload of xref:nlohmann/ordered_map/insert-0e.adoc[`insert`] | xref:nlohmann/ordered_map/size_type.adoc[`size_type`] | an unsigned integer type used to represent sizes and counts | xref:nlohmann/ordered_map/value_type.adoc[`value_type`] | the type of the key‐value pairs stored in the underlying container |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:nlohmann/ordered_map/2constructor-03.adoc[`ordered_map`] [.small]#[constructor]# | Constructors | xref:nlohmann/ordered_map/2destructor.adoc[`~ordered_map`] [.small]#[destructor]# | destructor | xref:nlohmann/ordered_map/operator_assign-05.adoc[`operator=`] | Assignment operators | xref:nlohmann/ordered_map/at-07.adoc[`at`] | accesses the element with the given key, with bounds checking | xref:nlohmann/ordered_map/count-0d.adoc[`count`] | returns the number of elements matching the given key | xref:nlohmann/ordered_map/emplace-01.adoc[`emplace`] | inserts a new element constructed from _key_ and _t_ if the key does not already exist | xref:nlohmann/ordered_map/erase-0f.adoc[`erase`] | `erase` overloads | xref:nlohmann/ordered_map/find-08.adoc[`find`] | finds an element with the given key | xref:nlohmann/ordered_map/insert-0e.adoc[`insert`] | `insert` overloads | xref:nlohmann/ordered_map/operator_subs-0e.adoc[`operator[]`] | Subscript operators |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#