The real return type is a masquerade reference Values<Map>& referring to the originator map.
The real return type is a masquerade reference Keys<Map>& referring to the originator map.
Either a functor class satisfying the extended requirements for unary operations, or an untyped template of such a class wrapped into BuildUnary or BuildUnaryIt (preferably expressed via the convenience typedef from namespace polymake::operations.
This assertion is checked only in the AVL_CHECKS compilation mode.
Either a functor class satisfying the extended requirements for binary operations, or an untyped template of such a class wrapped into BuildBinary or BuildBinaryIt (preferably expressed via the convenience typedef from namespace polymake::operations.
The real return type is a temporary object pm::TransformedContainer< const KeyContainer&, operations::associative<Map> > . It serves as a proxy object forwarding the lookup requests for single keys to the originator Map object.

Prerequisits

#include <Map.h>
using namespace polymake; 

Introduction

template <typename Key, typename Data, typename KeyComparator=operations::cmp> class Map;

An associative container in the STL sense. It differs from the standard std::map in the implementation: it uses an AVL tree instead of the red-black tree. The tree is attached via a smart pointer with REFCOUNT.

Construction

Map(); explicit Map (const KeyComparator&)
Create an empty map. Initialize the element comparator with its default constructor (the first variant) or from a given prototype (the second variant).
template <typename Iterator> Map (Iterator src, Iterator src_end); template <typename EndSensitiveIterator> Map (EndSensitiveIterator src);
Initialize the map elements from an input sequence. The keys must follow in the ascending order in the sense of the KeyComparator.

Modification

void std::swap(Map&, Map&);
Swap the contents of two maps in a most efficient way.
void Map::clear();
Make the map empty.

Element access

Map inherits the AVL tree data access interface. The map entries accesible via iterators have the form std::pair<Key, Data> .

Sequential access

const GenericSet& keys (const Map&); const Container& values (const Map&);
Give separate access to the key and data parts of the map entries. Since the keys are sorted, the key sequence belongs to the GenericSet family. The data parts (values) are visited in the same order as the keys.
The names of these functions are chosen deliberately identical to those of standard perl functions.

Random access

template <typename SomeKey> Data& operator[] (const SomeKey&); template <typename SomeKey> const Data& operator[] (const SomeKey&) const throw (no_match);
Find the data element associated with the given key. If it didn't exist so far, it will be created with the default constructor of Data in the non-const variant, while the const method will raise an exception, since it is not allowed to create new elements.
Note that the type of the search key is not necessarily the same as of the map entries. It suffices that both are comparable with each other.
template <typename KeyContainer> Container operator[] (const KeyContainer&); template <typename KeyContainer> const Container operator[] (const KeyContainer&) const throw (no_match);
Create a pseudo-container consisting of data elements associated with the given keys. Non-existent elements are handled analogously to the single-key operator[].
The idea of this operator is leaned from perl, too.
Note that the implementation of the single-key and multi-key search operators is one and the same method; they are explained separately with the only aim: to describe the result types as simple as possible.

Exception type

class no_match : public std::runtime_error

Raised by random search methods of associative containers, such as Map, if a search key can not be found and the container object is immutable.