Polymake Template Library (PTL): pm::Map< K, D, Comparator > Class Template Reference
pm::Map< K, D, Comparator > Class Template Reference

Associative array based on AVL::tree. More...

Inherits pm::modified_tree< Top, TParams >.

Collaboration diagram for pm::Map< K, D, Comparator >:

Public Member Functions

 Map ()
 Create an empty Map. Initialize the element comparator with its default constructor.
 
 Map (const Comparator &cmp_arg)
 Create an empty Map with non-default comparator.
 
template<typename Iterator >
 Map (Iterator &&src, Iterator &&src_end)
 Construct from an iterator.
 
void clear ()
 Clear all contents.
 
void swap (Map &m)
 Swap content with another Map in an efficient way. More...
 
template<typename TKeys >
assoc_helper< Map, TKeys >::result_type operator[] (const TKeys &k)
 Associative search. More...
 
template<typename TKeys >
assoc_helper< const Map, TKeys >::result_type operator[] (const TKeys &k) const
 Associative search (const). Find the data element associated with the given key. If it doesn't exist so far, it will raise an exception. More...
 
template<typename TKeys >
assoc_helper< const Map, TKeys >::result_type map (const TKeys &k) const
 synonym for const key lookup
 

Detailed Description

template<typename K, typename D, typename Comparator = operations::cmp>
class pm::Map< K, D, Comparator >

Associative array based on AVL::tree.

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 reference counting.

Member Function Documentation

template<typename K, typename D, typename Comparator = operations::cmp>
template<typename TKeys >
assoc_helper<Map, TKeys>::result_type pm::Map< K, D, Comparator >::operator[] ( const TKeys &  k)
inline

Associative search.

Find the data element associated with the given key. If it doesn't exist so far, it will be created with the default constructor.

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.

k can also be a container with keys; the result will be a sequence of corresponding values.

template<typename K, typename D, typename Comparator = operations::cmp>
template<typename TKeys >
assoc_helper<const Map, TKeys>::result_type pm::Map< K, D, Comparator >::operator[] ( const TKeys &  k) const
inline

Associative search (const). Find the data element associated with the given key. If it doesn't exist so far, it will raise an exception.

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.

k can also be a container with keys; the result will be a sequence of corresponding values.

template<typename K, typename D, typename Comparator = operations::cmp>
void pm::Map< K, D, Comparator >::swap ( Map< K, D, Comparator > &  m)
inline

Swap content with another Map in an efficient way.

Parameters
mthe other Map

The documentation for this class was generated from the following file: