indirectmap

Map whose keys are pointers, but are compared by their dereferenced values.

Synopsis

Declared in <indirectmap.h>

template<
    class K,
    class T>
class indirectmap;

Description

Differs from a plain std::map<const K*, T, DereferencingComparator<K*> > in that methods that take a key for comparison take a K rather than taking a K* (taking a K* would be confusing, since it's the value rather than the address of the object for comparison that matters due to the dereferencing comparator).

Objects pointed to by keys must not be modified in any way that changes the result of DereferencingComparator.

Type Aliases

NameDescription
const_iterator Constant iterator over the map entries.
iterator Mutable iterator over the map entries.
size_type Unsigned integer type used for sizes and counts.
value_type The key/value pair type stored in the map.

Member Functions

NameDescription
begin begin overloads
cbegin Get a const iterator to the first entry.
cend Get a const iterator past the last entry.
clear Remove all entries from the map.
count Count the entries whose key dereferences to the given value.
empty Report whether the map has no entries.
end end overloads
erase Erase the entry whose key dereferences to the given value.
find Find the entry whose key dereferences to the given value.
insert Insert a key/value pair, where the key is a pointer.
lower_bound Find the first entry whose key is not ordered before the given value.
max_size Get the maximum number of entries the map can hold.
size Get the number of entries in the map.

Non-Member Functions

NameDescription
memusage::DynamicUsageDynamic memory used by an indirectmap's tree nodes.
memusage::IncrementalDynamicUsageDynamic memory used by a single additional indirectmap node.