From Jason Turner

[hive.operations]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpc6q5rtzz/{from.md → to.md} +91 -0
tmp/tmpc6q5rtzz/{from.md → to.md} RENAMED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Operations <a id="hive.operations">[[hive.operations]]</a>
2
+
3
+ In this subclause, arguments for a template parameter named `Predicate`
4
+ or `BinaryPredicate` shall meet the corresponding requirements in
5
+ [[algorithms.requirements]]. The semantics of `i + n` and `i - n`, where
6
+ `i` is an iterator into the `hive` and `n` is an integer, are the same
7
+ as those of `next(i, n)` and `prev(i, n)`, respectively. For `sort`, the
8
+ definitions and requirements in [[alg.sorting]] apply.
9
+
10
+ ``` cpp
11
+ void splice(hive& x);
12
+ void splice(hive&& x);
13
+ ```
14
+
15
+ *Preconditions:* `get_allocator() == x.get_allocator()` is `true`.
16
+
17
+ *Effects:* If `addressof(x) == this` is `true`, the behavior is
18
+ erroneous and there are no effects. Otherwise, inserts the contents of
19
+ `x` into `*this` and `x` becomes empty. Pointers and references to the
20
+ moved elements of `x` now refer to those same elements but as members of
21
+ `*this`. Iterators referring to the moved elements continue to refer to
22
+ their elements, but they now behave as iterators into `*this`, not into
23
+ `x`.
24
+
25
+ *Throws:* `length_error` if any of `x`’s active blocks are not within
26
+ the bounds of *current-limits*.
27
+
28
+ *Complexity:* Linear in the sum of all element blocks in `x` plus all
29
+ element blocks in `*this`.
30
+
31
+ *Remarks:* Reserved blocks in `x` are not transferred into `*this`. If
32
+ `addressof(x) == this` is `false`, invalidates the past-the-end iterator
33
+ for both `x` and `*this`.
34
+
35
+ ``` cpp
36
+ template<class BinaryPredicate = equal_to<T>>
37
+ size_type unique(BinaryPredicate binary_pred = BinaryPredicate());
38
+ ```
39
+
40
+ *Preconditions:* `binary_pred` is an equivalence relation.
41
+
42
+ *Effects:* Erases all but the first element from every consecutive group
43
+ of equivalent elements. That is, for a nonempty `hive`, erases all
44
+ elements referred to by the iterator `i` in the range \[`begin() + 1`,
45
+ `end()`) for which `binary_pred(*i, *(i - 1))` is `true`.
46
+
47
+ *Returns:* The number of elements erased.
48
+
49
+ *Throws:* Nothing unless an exception is thrown by the predicate.
50
+
51
+ *Complexity:* If `empty()` is `false`, exactly `size() - 1` applications
52
+ of the corresponding predicate, otherwise no applications of the
53
+ predicate.
54
+
55
+ *Remarks:* Invalidates references, pointers, and iterators referring to
56
+ the erased elements. If the last element in `*this` is erased, also
57
+ invalidates the past-the-end iterator.
58
+
59
+ ``` cpp
60
+ template<class Compare = less<T>>
61
+ void sort(Compare comp = Compare());
62
+ ```
63
+
64
+ *Preconditions:* `T` is *Cpp17MoveInsertable* into `hive`,
65
+ *Cpp17MoveAssignable*, and *Cpp17Swappable*.
66
+
67
+ *Effects:* Sorts `*this` according to the `comp` function object. If an
68
+ exception is thrown, the order of the elements in `*this` is
69
+ unspecified.
70
+
71
+ *Complexity:* 𝑂(N log N) comparisons, where N is `size()`.
72
+
73
+ *Remarks:* May allocate. References, pointers, and iterators referring
74
+ to elements in `*this`, as well as the past-the-end iterator, may be
75
+ invalidated.
76
+
77
+ [*Note 1*: Not required to be
78
+ stable [[algorithm.stable]]. — *end note*]
79
+
80
+ ``` cpp
81
+ iterator get_iterator(const_pointer p) noexcept;
82
+ const_iterator get_iterator(const_pointer p) const noexcept;
83
+ ```
84
+
85
+ *Preconditions:* `p` points to an element in `*this`.
86
+
87
+ *Returns:* An `iterator` or `const_iterator` pointing to the same
88
+ element as `p`.
89
+
90
+ *Complexity:* Linear in the number of active blocks in `*this`.
91
+