Полезное:
Как сделать разговор полезным и приятным
Как сделать объемную звезду своими руками
Как сделать то, что делать не хочется?
Как сделать погремушку
Как сделать так чтобы женщины сами знакомились с вами
Как сделать идею коммерческой
Как сделать хорошую растяжку ног?
Как сделать наш разум здоровым?
Как сделать, чтобы люди обманывали меньше
Вопрос 4. Как сделать так, чтобы вас уважали и ценили?
Как сделать лучше себе и другим людям
Как сделать свидание интересным?
Категории:
АрхитектураАстрономияБиологияГеографияГеологияИнформатикаИскусствоИсторияКулинарияКультураМаркетингМатематикаМедицинаМенеджментОхрана трудаПравоПроизводствоПсихологияРелигияСоциологияСпортТехникаФизикаФилософияХимияЭкологияЭкономикаЭлектроника
|
Словарь с дубликатами - multimарmultimар - ассоциативный контейнер, который поддерживает равные ключи (возможно, содержит множественные копии того же самого значения ключа) и обеспечивает быстрый поиск значений другого типа T, связанных с ключами.
template <class Key, class T, class Compare = less<Key>, template <class U> class Allocator = allocator> class multimap { public:
// Определения типов:
typedef Key key_type; typedef pair<const Key, T> value_type; typedef Compare key_compare; 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) { return comp(x.first, y.first); } }; typedef iterator; typedef const_iterator; typedef Allocator<value_type>::pointer pointer; typedef Allocator<value_type>::reference reference; typedef Allocator<value_type>::const_reference const_reference; typedef size_type; typedef difference_type; typedef reverse_iterator; typedef const_reverse_iterator;
// Захват/освобождение памяти:
multimap(const Compare& comp = Compare()); template <class InputIterator> multimap(InputIterator first, InputIterator last, const Compare& comp = Compare()); multimap(const multimap<Key, T, Compare, Allocator>& x); ~multimap(); multimap<Key, T, Compare, Allocator>& operator=(const multimap<Key, T, Compare, Allocator>& x); void swap(multimap<Key, T, Compare, Allocator>& x);
// Аксесуары:
key_compare key_comp() const; value_compare value_comp() const; iterator begin(); const_iterator begin() const; iterator end(); const_iterator end() const; reverse_iterator rbegin(); const_reverse_iterator rbegin(); reverse_iterator rend() const_reverse_iterator rend(); bool empty() const; size_type size() const; size_type max_size() const;
// Вставка/удаление
iterator insert(const value_type& x); iterator insert(iterator position, const value_type& x); template <class InputIterator> void insert(InputIterator first, InputIterator last); void erase(iterator position); size_type erase(const key_type& x); void erase(iterator first, iterator last);
// Операции над словарем с дубликатами:
iterator find(const key_type& x); const_iterator find(const key_type& x) const; size_type count(const key_type& x) const; iterator lower_bound(const key_type& x); const_iterator lower_bound(const key_type& x) const; iterator upper_bound(const key_type& x); const_iterator upper_bound(const key_type& x) const; pair<iterator, iterator> equal_range(const key_type& x); pair<const_iterator, const_iterator> equal_range(const key_type& x) const; };
template <class Key, class T, class Compare, class Allocator> bool operator==(const multimap<Key, T, Compare, Allocator>& x, const multimap<Key, T, Compare, Allocator>& y);
template <class Key, class T, class Compare, class Allocator> bool operator<(const multimap<Key, T, Compare, Allocator>& x, const multimap<Key, T, Compare, Allocator>& y);
iterator - двунаправленный итератор, указывающий на value_type. Точный тип зависит от реализации и определяется в Allocator. const_iterator - постоянный двунаправленный итератор, указывающий на value_type. Точный тип зависит от реализации и определяется в Allocator. Гарантируется, что имеется конструктор для const_iterator из iterator. size_type - целочисленный тип без знака. Точный тип зависит от реализации и определяется в Allocator. difference_type - целочисленный тип со знаком. Точный тип зависит от реализации и определяется в Allocator.
В языке С++ имеются два типа шаблонов - шаблоны функций и шаблоны классов.
|