mirror of https://github.com/CGAL/cgal
110 lines
3.6 KiB
TeX
110 lines
3.6 KiB
TeX
|
|
\ccHtmlNoClassLinks
|
|
\begin{ccClassTemplate} {map<Key, T, Compare>}
|
|
|
|
\ccSection{map}
|
|
|
|
\ccDefinition
|
|
An object of the class \ccClassTemplateName\ supports unique keys of
|
|
type \ccStyle{Key}, and provides retrieval of values of type \ccStyle{T}
|
|
based on the keys. The keys into the map are ordered by the ordering
|
|
relation \ccStyle{Compare}.
|
|
|
|
Elements are stored in maps as \ccStyle{pairs} of \ccStyle{Key} and
|
|
\ccStyle{T}.
|
|
|
|
\ccInclude{map}
|
|
|
|
\ccTypes
|
|
\ccNestedType{iterator}{A const bidirectional iterator.}
|
|
|
|
|
|
\ccCreation
|
|
\ccCreationVariable{M}
|
|
|
|
|
|
\ccConstructor{map(const Compare& comp = Compare());}
|
|
{Introduces an empty map.}
|
|
|
|
\ccConstructor{map(const map<Key, T, Compare> &M1);}
|
|
{Copy constructor.}
|
|
|
|
\ccOperations
|
|
|
|
|
|
\ccMethod{map<Key, T, Compare> & operator=(const map<Key, T, Compare> &M1);}
|
|
{Assignment.}
|
|
|
|
\ccMethod{bool operator==(const map<Key, T, Compare> &M1);}
|
|
{Equality test: Two maps are equal, if the sequences \ccVar\ and \ccStyle{M1}
|
|
are elementwise equal.}
|
|
|
|
|
|
\ccMethod{bool operator<(const map<Key, T, Compare> &M1);}
|
|
{Returns \ccStyle{true} if \ccVar\ is lexicographically less than \ccStyle{M1},
|
|
\ccStyle{false} otherwise.}
|
|
|
|
\ccMethod{iterator begin() const;}
|
|
{Returns a constant iterator referring to the first element in
|
|
map~\ccVar.}
|
|
|
|
\ccMethod{iterator end() const;}
|
|
{Returns a constant past-the-end iterator of map~\ccVar.}
|
|
|
|
\ccMethod{bool empty() const;}
|
|
{Returns \ccStyle{true} if \ccVar\ is empty.}
|
|
|
|
\ccMethod{int size() const;}
|
|
{Returns the number of items in map~\ccVar.}
|
|
|
|
\ccMethod{T& operator[](const Key& k);}
|
|
{Returns a reference to the type \ccStyle{T} value associated with
|
|
key \ccStyle{k}. If the map is constant then a const reference is
|
|
returned. In contrast to vector or deque, the \ccStyle{pair(k,T())}
|
|
is inserted into the map, if no element is associated with the key.}
|
|
|
|
\ccHeading{Insert and Erase}
|
|
|
|
\ccMethod{iterator insert(iterator pos, pair<const Key&,T> val);}
|
|
{Inserts \ccStyle{val} into the map if \ccStyle{val} is not already
|
|
present in \ccVar. The iterator \ccStyle{pos} is the starting point of
|
|
the search. The return value points to the inserted item.}
|
|
|
|
\ccMethod{pair<iterator, bool> insert(pair<const Key&,T> val);}
|
|
{Inserts \ccStyle{val} into the map if \ccStyle{val} is not already
|
|
present in \ccVar. Returns a pair, where \ccStyle{first}
|
|
is the iterator that points to the inserted item or to the
|
|
item that is already present in \ccVar, and where \ccStyle{second}
|
|
is \ccStyle{true} if the insertion took place.}
|
|
|
|
\ccMethod{void erase(iterator pos);}
|
|
{Erases the element where pos points to.}
|
|
|
|
\ccMethod{int erase(Key k);}
|
|
{Erases all elements that equal \ccStyle{k}. Returns the number
|
|
of erased elements.}
|
|
|
|
\ccHeading{Miscellaneous}
|
|
|
|
\ccMethod{iterator find(Key k);}
|
|
{Returns an iterator that either points to the element \ccStyle{k},
|
|
or \ccStyle{end()} if \ccStyle{k} is not present in map \ccVar.}
|
|
|
|
\ccMethod{int count(Key k);}
|
|
{Returns the number of occurrences of \ccStyle{k} in map \ccVar.}
|
|
|
|
|
|
\ccMethod{iterator lower_bound(Key k);}
|
|
{Returns an iterator that points to the first element of \ccVar\
|
|
that is not less than \ccStyle{k}. If all elements are less than
|
|
\ccStyle{k} then \ccStyle{end()} is returned. If \ccStyle{k}
|
|
is present in the map the returned iterator points to \ccStyle{k}.}
|
|
|
|
\ccMethod{iterator upper_bound(Key k);}
|
|
{Returns an iterator that points to the first element of the map
|
|
that is greater than \ccStyle{k}. If no element is greater than
|
|
\ccStyle{k} then \ccStyle{end()} is returned. If \ccStyle{k}
|
|
is present in the map the returned iterator points to \ccStyle{k}.}
|
|
|
|
\end{ccClassTemplate}
|