Skip to content

Commit 0126775

Browse files
committed
[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 fbd1a70 commit 0126775

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
@@ -17792,32 +17792,11 @@
1779217792
\begin{itemdescr}
1779317793
\pnum
1779417794
\effects
17795-
Adds elements to \exposid{c} as if by:
17796-
\begin{codeblock}
17797-
for (; first != last; ++first) {
17798-
value_type value = *first;
17799-
@\exposid{c}@.keys.insert(@\exposid{c}@.keys.end(), std::move(value.first));
17800-
@\exposid{c}@.values.insert(@\exposid{c}@.values.end(), std::move(value.second));
17801-
}
17802-
\end{codeblock}
17803-
Then, merges the sorted range of newly added elements and
17804-
the sorted range of pre-existing elements into a single sorted range; and
17805-
finally erases the duplicate elements as if by:
17806-
\begin{codeblock}
17807-
auto zv = views::zip(@\exposid{c}@.keys, @\exposid{c}@.values);
17808-
auto it = ranges::unique(zv, @\exposid{key-equiv}@(@\exposid{compare}@)).begin();
17809-
auto dist = distance(zv.begin(), it);
17810-
@\exposid{c}@.keys.erase(@\exposid{c}@.keys.begin() + dist, @\exposid{c}@.keys.end());
17811-
@\exposid{c}@.values.erase(@\exposid{c}@.values.begin() + dist, @\exposid{c}@.values.end());
17812-
\end{codeblock}
17795+
Equivalent to \tcode{insert(first, last)}.
1781317796

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

1782317802
\indexlibrarymember{insert_range}{flat_map}%

0 commit comments

Comments
 (0)