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

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

Inherits pm::modified_tree< Top, Params >.

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

Public Member Functions

 Map ()
 Create an empty Map. Initialize the element comparator with its default constructor.
 
 Map (const key_comparator_type &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 Keys >
assoc_helper< Map, Keys >::result_type operator[] (const Keys &k)
 Associative search. More...
 
template<typename Keys >
assoc_helper< const Map, Keys >::result_type operator[] (const Keys &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 Keys >
assoc_helper< const Map, Keys >::result_type map (const Keys &k) const
 synonym for const key lookup
 

Detailed Description

template<typename K, typename D, typename... Params>
class pm::Map< K, D, Params >

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

◆ operator[]() [1/2]

template<typename K , typename D , typename... Params>
template<typename Keys >
assoc_helper<Map, Keys>::result_type pm::Map< K, D, Params >::operator[] ( const Keys &  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.

◆ operator[]() [2/2]

template<typename K , typename D , typename... Params>
template<typename Keys >
assoc_helper<const Map, Keys>::result_type pm::Map< K, D, Params >::operator[] ( const Keys &  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.

◆ swap()

template<typename K , typename D , typename... Params>
void pm::Map< K, D, Params >::swap ( Map< K, D, Params > &  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: