|
map< Key, T, Compare > Class Template Reference#include <c11p634.h>
List of all members.
Detailed Description
template<typename Key, typename T, typename Compare = less<Key>>
class map< Key, T, Compare >
Definition at line 15 of file c11p634.h.
|
Public Member Functions |
| map (const Compare &cmp=Compare()) |
template<typename InputIter> |
| map (InputIter first, InputIter last, const Compare &comp=Compare()) |
bool | empty () const |
size_type | size () const |
size_type | max_size () const |
Iter | insert (Iter i, const value_type &e) |
Iter | erase (Iter i) void erase(Iter first |
Iter | find (const key_value &e) const |
size_type | count (const key_type &k) |
Iter | lower_bound (const key_type &k) const |
Iter | upper_bound (const key_type &k) const |
void | swap (map< Key, T, Compare > &m) |
Iter | begin () |
Iter | end () |
Public Attributes |
Iter Iter | last |
Constructor & Destructor Documentation
template<typename Key, typename T, typename Compare = less<Key>> |
map< Key, T, Compare >::map |
( |
const Compare & |
cmp = Compare() |
) |
[explicit] |
|
|
Default constructor - Precondition:
- The default comparison operator is <.
- Postcondition:
- The map object is initialized to be empty.
- Parameters:
-
| cmp | A comparison function object. |
|
template<typename Key, typename T, typename Compare = less<Key>> |
template<typename InputIter> |
map< Key, T, Compare >::map |
( |
InputIter |
first, |
|
|
InputIter |
last, |
|
|
const Compare & |
comp = Compare() |
|
) |
|
|
|
Constructor: map is initialized with length last - first and filled with all values from the dereferenced input iterators on the range [first, last]. - Precondition:
- None.
- Postcondition:
- The map contains input iterators in the range [first, last].
- Parameters:
-
| comp | A comparison function object. |
|
Member Function Documentation
template<typename Key, typename T, typename Compare = less<Key>> |
bool map< Key, T, Compare >::empty |
( |
|
) |
const |
|
|
Determines whether the map is empty. - Precondition:
- None.
- Postcondition:
- None.
- Returns:
- True if the map is empty, otherwise returns false.
|
template<typename Key, typename T, typename Compare = less<Key>> |
size_type map< Key, T, Compare >::size |
( |
|
) |
const |
|
|
Determines the size of the map. The return type size_type is an integral type. - Precondition:
- None.
- Postcondition:
- None.
- Returns:
- The number of items that are currently in the map.
|
template<typename Key, typename T, typename Compare = less<Key>> |
size_type map< Key, T, Compare >::max_size |
( |
|
) |
const |
|
|
Determines the maximum number of elements the map can hold. - Precondition:
- None.
- Postcondition:
- None.
- Returns:
- The maximum number of elements.
|
template<typename Key, typename T, typename Compare = less<Key>> |
Iter map< Key, T, Compare >::insert |
( |
Iter |
i, |
|
|
const value_type & |
e |
|
) |
|
|
|
Inserts element pair e into the map if a value_type with the same key is not already present in the map. Takes an optional iterator parameter as a hint as to where to insert. - Precondition:
- The iterator is initialized.
- Postcondition:
- Element e has been inserted into the map.
- Returns:
- An iterator to e.
|
template<typename Key, typename T, typename Compare = less<Key>> |
Iter map< Key, T, Compare >::erase |
( |
Iter |
i |
) |
|
|
|
Removes all map elements in the range (first, last). - Precondition:
- None.
- Postcondition:
- The map has no elements in the range [first, last].
|
template<typename Key, typename T, typename Compare = less<Key>> |
Iter map< Key, T, Compare >::find |
( |
const key_value & |
e |
) |
const |
|
|
Returns an iterator that points to the element equal to e. - Precondition:
- None.
- Postcondition:
- None.
- Returns:
- If element e was in the map, an iterator that points to e is returned; otherwise, the value returned by end() is returned.
|
template<typename Key, typename T, typename Compare = less<Key>> |
size_type map< Key, T, Compare >::count |
( |
const key_type & |
k |
) |
|
|
|
Returns number of elements equal to k. - Precondition:
- None.
- Postcondition:
- None.
- Returns:
- The number of elements equal to k. Since a map has unique keys, count will always return 1 or 0.
|
template<typename Key, typename T, typename Compare = less<Key>> |
Iter map< Key, T, Compare >::lower_bound |
( |
const key_type & |
k |
) |
const |
|
|
Returns an iterator that points to the first key that is equal to or greater than k. - Precondition:
- None.
- Postcondition:
- None.
- Returns:
- The comparison function object for the set.
|
template<typename Key, typename T, typename Compare = less<Key>> |
Iter map< Key, T, Compare >::upper_bound |
( |
const key_type & |
k |
) |
const |
|
|
Returns an iterator that points to the first key that is greater than e. - Precondition:
- None.
- Postcondition:
- None.
- Returns:
- The comparison function object for the set.
|
template<typename Key, typename T, typename Compare = less<Key>> |
void map< Key, T, Compare >::swap |
( |
map< Key, T, Compare > & |
m |
) |
|
|
|
Exchanges maps. - Precondition:
- None.
- Postcondition:
- Exchanges the contents of the map m with the current map, *this.
|
template<typename Key, typename T, typename Compare = less<Key>> |
Iter map< Key, T, Compare >::begin |
( |
|
) |
|
|
|
Returns an iterator to the first element in the map. - Precondition:
- None.
- Postcondition:
- None.
- Returns:
- If the map was empty, the value returned by end() is returned.
|
template<typename Key, typename T, typename Compare = less<Key>> |
Iter map< Key, T, Compare >::end |
( |
|
) |
|
|
|
Returns an iterator to test for the end of the map. - Precondition:
- None.
- Postcondition:
- None.
- Returns:
- The value for the end of the map is returned.
|
Member Data Documentation
template<typename Key, typename T, typename Compare = less<Key>> |
Iter Iter map< Key, T, Compare >::last |
|
The documentation for this class was generated from the following file:
|