Name

multimap class template — Associative map container with duplicate keys

Synopsis

template <class Key, class T, class Compare = less<Key>,
          class Alloc = allocator<pair<const Key, T> > >
class multimap {
public:
  typedef Key key_type;
  typedef T mapped_type;
  typedef pair<const Key,T> value_type;
  typedef Compare key_compare;
  typedef Alloc allocator_type;
  typedef typename Alloc::reference reference;
  typedef typename Alloc::const_reference const_reference;
  typedef  . . .  iterator;
  typedef  . . .  const_iterator;
  typedef  . . .  size_type;
  typedef  . . .  difference_type;
  typedef typename Alloc::pointer pointer;
  typedef typename Alloc::const_pointer const_pointer;
  typedef std::reverse_iterator<iterator> reverse_iterator;
  typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
  class value_compare :
    public binary_function<value_type,value_type,bool>
  {
    friend class multimap;
  protected:
    Compare comp;
    value_compare(Compare c) : comp(c) {}
  public:
    bool operator(  )(const value_type& x, const value_type& y)
      const { return comp(x.first, y.first); }
  };
   
  explicit multimap(const Compare& comp = Compare(  ), 
    const Alloc& = Alloc(  ));
  template <class InputIterator>
  multimap(InputIterator first, InputIterator last,
    const Compare& comp = Compare(  ), const Alloc& = Alloc(  ));
  multimap(const multimap<Key,T,Compare,Alloc>& x);
  ~multimap(  );
  multimap<Key,T,Compare,Alloc>&
    operator=(const multimap<Key,T,Compare,Alloc>& x);
  allocator_type get_allocator(  ) const;
  // Iterators
  iterator begin( ); const_iterator ...

Get C++ In a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.