std::set::merge
Материал из cppreference.com
template<class C2> void merge(std::set<Key, C2, Allocator>& source); |
(1) | (начиная с C++17) |
template<class C2> void merge(std::set<Key, C2, Allocator>&& source); |
(2) | (начиная с C++17) |
template<class C2> void merge(std::multiset<Key, C2, Allocator>& source); |
(3) | (начиная с C++17) |
template<class C2> void merge(std::multiset<Key, C2, Allocator>&& source); |
(4) | (начиная с C++17) |
Пытается извлечь ("splice") каждый элемент из source и вставить его в *this, используя сравнение *this.
If there is an element in *this with key equivalent to the key of an element from source, then that element is not extracted from source.
No elements are copied or moved, only the internal pointers of the container nodes are repointed. All pointers and references to the transferred elements remain valid, but now refer into *this, not into source.
Поведение неопределено, если get_allocator() != source.get_allocator().
Параметры
| source | — | совместимый контейнер для передачи узлов из контейнера |
Возвращаемое значение
(none)
Исключения
Не бросает, если сравнение не бросает.
Сложность
N*log(size()+N)), где N = source.size()
Пример
| Этот раздел не завершён Причина: нет примера |
См. также
(C++17) |
извлекает узлы из контейнера (public функция-элемент) |
| вставляет элементы или узлы (начиная с C++17) (public функция-элемент) |