nlohmann::ordered_map

a minimal map-like container that preserves insertion order

Synopsis

Declared in <nlohmann/ordered_map.hpp>

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

NameDescription
std::vector<std::pair<Key const, T>, Allocator>A standard container which offers fixed time access to individual elements in any order.

Type Aliases

NameDescription
Container the underlying container type used to store the key-value pairs
const_iterator a const iterator over the underlying container
iterator an iterator over the underlying container
key_compare the comparison function used to determine whether two keys are equal
key_type the type of the keys stored in the map
mapped_type the type of the values mapped to each key
require_input_iter helper type that is only defined if InputIt qualifies as an input iterator, used to constrain the iterator-range overload of insert
size_type an unsigned integer type used to represent sizes and counts
value_type the type of the key-value pairs stored in the underlying container

Member Functions

NameDescription
ordered_map [constructor]Constructors
~ordered_map [destructor]destructor
operator= Assignment operators
at accesses the element with the given key, with bounds checking
count returns the number of elements matching the given key
emplace inserts a new element constructed from key and t if the key does not already exist
erase erase overloads
find finds an element with the given key
insert insert overloads
operator[] Subscript operators