Skip to content

Commit 7f1926b

Browse files
jwakelytkoeppe
authored andcommitted
[flat.map.modifiers] Remove redundancy in 'insert(sorted_unique, i, j)'
We can specify this in terms of the overload without the `sorted_unique` tag. That is consistent with how the equivalent functions in `flat_set` and `flat_multiset` are specified.
1 parent 7089fb2 commit 7f1926b

File tree

1 file changed

+1
-22
lines changed

1 file changed

+1
-22
lines changed

source/containers.tex

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17793,32 +17793,11 @@
1779317793
\begin{itemdescr}
1779417794
\pnum
1779517795
\effects
17796-
Adds elements to \exposid{c} as if by:
17797-
\begin{codeblock}
17798-
for (; first != last; ++first) {
17799-
value_type value = *first;
17800-
@\exposid{c}@.keys.insert(@\exposid{c}@.keys.end(), std::move(value.first));
17801-
@\exposid{c}@.values.insert(@\exposid{c}@.values.end(), std::move(value.second));
17802-
}
17803-
\end{codeblock}
17804-
Then, merges the sorted range of newly added elements and
17805-
the sorted range of pre-existing elements into a single sorted range; and
17806-
finally erases the duplicate elements as if by:
17807-
\begin{codeblock}
17808-
auto zv = views::zip(@\exposid{c}@.keys, @\exposid{c}@.values);
17809-
auto it = ranges::unique(zv, @\exposid{key-equiv}@(@\exposid{compare}@)).begin();
17810-
auto dist = distance(zv.begin(), it);
17811-
@\exposid{c}@.keys.erase(@\exposid{c}@.keys.begin() + dist, @\exposid{c}@.keys.end());
17812-
@\exposid{c}@.values.erase(@\exposid{c}@.values.begin() + dist, @\exposid{c}@.values.end());
17813-
\end{codeblock}
17796+
Equivalent to \tcode{insert(first, last)}.
1781417797

1781517798
\pnum
1781617799
\complexity
1781717800
Linear in $N$, where $N$ is \tcode{size()} after the operation.
17818-
17819-
\pnum
17820-
\remarks
17821-
Since this operation performs an in-place merge, it may allocate memory.
1782217801
\end{itemdescr}
1782317802

1782417803
\indexlibrarymember{insert_range}{flat_map}%

0 commit comments

Comments
 (0)