std::multimap
Материал из cppreference.com
| Справка по C++ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Контейнеры | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| std::multimap | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Заголовочный файл <map>
|
||
| template< class Key, |
||
Multimap - это ассоциативный контейнер, который содержит сортированный список пар ключ-значение. Сортировка производится функцией сравнения Compare применительно к ключам. Поиск, вставка и удаление имеют логарифмическую сложность.
Порядок пар ключ-значение, чьи ключи при сравнении оказываются одинаковыми, совпадает с порядком их вставки и не изменяется. (начиная с C++11)
std::multimap соответствует требованиям Container, AllocatorAwareContainer, AssociativeContainer и ReversibleContainer.
Содержание |
[править] Member types
| Member type | Definition |
| key_type | Key |
| mapped_type | T |
| value_type | std::pair<const Key, T> |
| size_type | Unsigned integral type (usually size_t) |
| difference_type | Signed integer type (usually ptrdiff_t) |
| key_compare | Compare |
| allocator_type | Allocator |
| reference | Allocator::reference (до C++11) value_type& (начиная с C++11) |
| const_reference | Allocator::const_reference (до C++11) const value_type& (начиная с C++11) |
| pointer | Allocator::pointer (до C++11) std::allocator_traits<Allocator>::pointer (начиная с C++11) |
| const_pointer | Allocator::const_pointer (до C++11) std::allocator_traits<Allocator>::const_pointer (начиная с C++11) |
| iterator | BidirectionalIterator |
| const_iterator | Constant bidirectional iterator |
reverse_iterator
|
std::reverse_iterator<iterator> |
const_reverse_iterator
|
std::reverse_iterator<const_iterator> |
[править] Member classes
| compares objects of type value_type (класс) | |
[править] Методы (фунции-члены)
| создает multimap (public member function) | |
| уничтожает multimap (public member function) | |
| assigns values to the container (public member function) | |
| returns the associated allocator (public member function) | |
Итераторы | |
| возвращает итератор на начало (public member function) | |
| возвращает итератор на конец (public member function) | |
| returns a reverse iterator to the beginning (public member function) | |
| returns a reverse iterator to the end (public member function) | |
Емкость | |
| checks whether the container is empty (public member function) | |
| returns the number of elements (public member function) | |
| returns the maximum possible number of elements (public member function) | |
Модификаторы | |
| clears the contents (public member function) | |
| inserts elements (public member function) | |
| (C++11) |
конструирует элемент "на месте" (public member function) |
| (C++11) |
constructs elements in-place using a hint (public member function) |
| erases elements (public member function) | |
| swaps the contents (public member function) | |
Поиск | |
| returns the number of elements matching specific key (public member function) | |
| finds element with specific key (public member function) | |
| returns range of elements matching a specific key (public member function) | |
| returns an iterator to the first element not less than the given value (public member function) | |
| returns an iterator to the first element greater than a certain value (public member function) | |
Observers | |
| возвращает функцию, сравнивающую ключи (public member function) | |
| возвращает функцию, сравнивающую значения (public member function) | |
[править] Функции не члены
| lexicographically compares the values in the container (функция) | |
| specializes the std::swap algorithm (шаблон функции) | |