nlohmann::ordered_map::erase

erase overloads

Synopses

Declared in <nlohmann/ordered_map.hpp>

removes the element at the given position

iterator
erase(iterator pos);
» more...

removes the element with the given key, if it exists

size_type
erase(key_type const& key);
» more...

removes the element with the given key, if it exists

template<class KeyType>
requires detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value
size_type
erase(KeyType&& key);
» more...

removes the elements in the range [first, last)]

iterator
erase(
    iterator first,
    iterator last);
» more...

Return Value

  • iterator following the removed element
  • number of elements removed (0 or 1)
  • iterator following the last removed element

Parameters

NameDescription
pos [in]iterator to the element to remove
key [in]key of the element to remove
first [in]iterator to the first element to remove
last [in]iterator past the last element to remove