nlohmann::ordered_map::operator[]

accesses the element with the given key

Synopsis

Declared in <nlohmann/ordered_map.hpp>

template<class KeyType>
requires detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value
T const&
operator[](KeyType&& key) const;

Exceptions

NameThrown on
std::out_of_rangeif the container does not have an element with the given key

Return Value

const reference to the value associated with key

Parameters

NameDescription
key [in]key of the element to access