[#nlohmann-ordered_map]
= xref:nlohmann.adoc[nlohmann]::ordered&lowbar;map
:relfileprefix: ../
:mrdocs:

a minimal map&hyphen;like container that preserves insertion order

== Synopsis

Declared in `&lt;nlohmann&sol;ordered&lowbar;map&period;hpp&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class Key,
    class T,
    class IgnoredLess = std::less&lt;Key&gt;,
    class Allocator = std::allocator&lt;std::pair&lt;Key const, T&gt;&gt;&gt;
struct ordered&lowbar;map
    : std::vector&lt;std::pair&lt;Key const, T&gt;, Allocator&gt;
----

== Description

ordered&lowbar;map&colon; a minimal map&hyphen;like container that preserves insertion order for use within nlohmann&colon;&colon;basic&lowbar;json&lt;ordered&lowbar;map&gt;

== Base Classes

[cols="1,4"]
|===
| Name| Description
| `std::vector&lt;std::pair&lt;Key const, T&gt;, Allocator&gt;`
| A standard container which offers fixed time access to  individual elements in any order&period;
|===

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:nlohmann/ordered_map/Container.adoc[`Container`] 
| the underlying container type used to store the key&hyphen;value pairs
| xref:nlohmann/ordered_map/const_iterator.adoc[`const&lowbar;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&lowbar;compare`] 
| the comparison function used to determine whether two keys are equal
| xref:nlohmann/ordered_map/key_type.adoc[`key&lowbar;type`] 
| the type of the keys stored in the map
| xref:nlohmann/ordered_map/mapped_type.adoc[`mapped&lowbar;type`] 
| the type of the values mapped to each key
| xref:nlohmann/ordered_map/require_input_iter.adoc[`require&lowbar;input&lowbar;iter`] 
| helper type that is only defined if _InputIt_ qualifies as an input iterator, used to constrain the iterator&hyphen;range overload of xref:nlohmann/ordered_map/insert-0e.adoc[`insert`]
| xref:nlohmann/ordered_map/size_type.adoc[`size&lowbar;type`] 
| an unsigned integer type used to represent sizes and counts
| xref:nlohmann/ordered_map/value_type.adoc[`value&lowbar;type`] 
| the type of the key&hyphen;value pairs stored in the underlying container
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:nlohmann/ordered_map/2constructor-03.adoc[`ordered&lowbar;map`]         [.small]#[constructor]#
| Constructors
| xref:nlohmann/ordered_map/2destructor.adoc[`&#126;ordered&lowbar;map`] [.small]#[destructor]#
| destructor
| xref:nlohmann/ordered_map/operator_assign-05.adoc[`operator&equals;`] 
| 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&lsqb;&rsqb;`] 
| Subscript operators
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
