[#nlohmann-ordered_map-operator_subs-02]
= xref:nlohmann.adoc[nlohmann]::xref:nlohmann/ordered_map.adoc[ordered&lowbar;map]::operator&lsqb;&rsqb;
:relfileprefix: ../../
:mrdocs:

accesses the element with the given key

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class KeyType&gt;
requires detail&colon;&colon;is&lowbar;usable&lowbar;as&lowbar;key&lowbar;type&lt;key&lowbar;compare, key&lowbar;type, KeyType&gt;&colon;&colon;value
T const&
operator&lsqb;&rsqb;(KeyType&& key) const;
----

== Exceptions

[cols="1,4"]
|===
| Name| Thrown on
| `std&colon;&colon;out&lowbar;of&lowbar;range`
| if the container does not have an element with the given key
|===

== Return Value

const reference to the value associated with _key_

== Parameters

[cols="1,4"]
|===
| Name| Description
| *key* [in]
| key of the element to access
|===


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