allocator_type
·
begin
·
clear
·
const_iterator
·
const_reference
·
const_reverse_iterator
·
count
·
difference_type
·
empty
·
end
·
equal_range
·
erase
·
find
·
get_allocator
·
insert
·
iterator
·
key_comp
·
key_compare
·
key_type
·
lower_bound
·
max_size
·
multimap
·
rbegin
·
reference
·
referent_type
·
rend
·
reverse_iterator
·
size
·
size_type
·
swap
·
upper_bound
·
value_comp
·
value_compare
·
value_type
template<class Key, class T, class Pred = less<Key>, class A = allocator<T> >
class multimap {
public:
typedef Key key_type;
typedef T referent_type;
typedef Pred key_compare;
typedef A allocator_type;
typedef pair<const Key, T> value_type;
class value_compare;
typedef A::size_type size_type;
typedef A::difference_type difference_type;
typedef A::rebind<value_type>::other::reference reference;
typedef A::rebind<value_type>::other::const_reference const_reference;
typedef T0 iterator;
typedef T1 const_iterator;
typedef reverse_bidirectional_iterator<iterator,
value_type, reference, A::pointer,
difference_type> reverse_iterator;
typedef reverse_bidirectional_iterator<const_iterator,
value_type, const_reference, A::const_pointer,
difference_type> const_reverse_iterator;
explicit multimap(const Pred& comp = Pred(), const A& al = A());
multimap(const multimap& x);
multimap(const value_type *first, const value_type *last,
const Pred& comp = Pred(), const A& al = A());
iterator begin();
const_iterator begin() const;
iterator end();
iterator end() const;
reverse_iterator rbegin();
const_reverse_iterator rbegin() const;
reverse_iterator rend();
const_reverse_iterator rend() const;
size_type size() const;
size_type max_size() const;
bool empty() const;
A get_allocator() const;
iterator insert(const value_type& x);
iterator insert(iterator it, const value_type& x);
void insert(const value_type *first, const value_type *last);
iterator erase(iterator it);
iterator erase(iterator first, iterator last);
size_type erase(const Key& key);
void clear();
void swap(multimap x);
key_compare key_comp() const;
value_compare value_comp() const;
iterator find(const Key& key);
const_iterator find(const Key& key) const;
size_type count(const Key& key) const;
iterator lower_bound(const Key& key);
const_iterator lower_bound(const Key& key) const;
iterator upper_bound(const Key& key);
const_iterator upper_bound(const Key& key) const;
pair<iterator, iterator> equal_range(const Key& key);
pair<const_iterator, const_iterator>
equal_range(const Key& key) const;
protected:
A allocator;
};
The template class describes an object that controls a varying-length sequence of elements of type pair
<const Key,
T>
. The first element of each pair is the sort key and the second is its associated value. The sequence is represented
in a way that permits lookup, insertion, and removal of an arbitrary element with a number of operations proportional to
the logarithm of the number of elements in the sequence (logarithmic time). Moreover, inserting an element invalidates
no iterators, and removing an element invalidates only those iterators that point at the removed element.
The object orders the sequence it controls by calling a stored function object of type Pred
. You access this stored
object by calling the member function key_comp
()
. Such a function object must impose a total order on sort keys. For
any element x
that precedes y
in the sequence, key_comp()(y.
first
, x.first)
is false. (For the default function
object less
<Key>
, sort keys never decrease in value.) Unlike template class map
, an object of template class
multimap
does not ensure that key_comp()(x.first, y.first)
is true. (Keys need not be unique.)
The object allocates and frees storage for the sequence it controls through a protected object named allocator
, of
class A
. Such an allocator object must have the same external interface as an object of template class allocator
.
Note that allocator
is not copied when the object is assigned.