Correct reference docs for merge()

This commit is contained in:
Christian Mazakas
2022-02-24 14:54:28 -08:00
parent 0d3ece98c1
commit 71d3b77668
4 changed files with 111 additions and 45 deletions
+28 -11
View File
@@ -121,7 +121,11 @@ namespace boost {
template<class H2, class P2>
void xref:#unordered_set_merge[merge](unordered_set<Key, H2, P2, Allocator>& source);
template<class H2, class P2>
void xref:#unordered_set_merge_rvalue_reference[merge](unordered_set<Key, H2, P2, Allocator>&& source);
void xref:#unordered_set_merge[merge](unordered_set<Key, H2, P2, Allocator>&& source);
template<class H2, class P2>
void xref:#unordered_set_merge[merge](unordered_multiset<Key, H2, P2, Allocator>& source);
template<class H2, class P2>
void xref:#unordered_set_merge[merge](unordered_multiset<Key, H2, P2, Allocator>&& source);
// observers
hasher xref:#unordered_set_hash_function[hash_function]() const;
@@ -1037,21 +1041,34 @@ Throws:;; Never throws an exception.
```c++
template<class H2, class P2>
void merge(unordered_set<Key, H2, P2, Allocator>& source);
```
[horizontal]
Notes:;; Does not support merging with a compatible `unordered_multiset` yet.
---
==== merge (rvalue reference)
```c++
template<class H2, class P2>
void merge(unordered_set<Key, H2, P2, Allocator>&& source);
template<class H2, class P2>
void merge(unordered_multiset<Key, H2, P2, Allocator>& source);
template<class H2, class P2>
void merge(unordered_multiset<Key, H2, P2, Allocator>&& source);
```
Attempt to "merge" two containers by iterating `source` and extracting any node in `source` that is not contained
in `*this` and then inserting it into `*this`.
Because `source` can have a different hash function and key equality predicate, the key of each node in
`source` is rehashed using `this\->hash_function()` and then, if required, compared using `this\->key_eq()`.
The behavior of this function is undefined if `this\->get_allocator() != source.get_allocator()`.
This function does not copy or move any elements and instead simply relocates the nodes from `source`
into `*this`.
[horizontal]
Notes:;; Does not support merging with a compatible `unordered_multiset` yet.
Notes:;;
+
--
* Pointers and references to transferred elements remain valid.
* Invalidates iterators to transferred elements.
* Invalidates iterators belonging to `*this`.
* Iterators to non-transferred elements in `source` remain valid.
--
---