1044510445 and \tcode{proj1} and \tcode{proj2} be \tcode{identity\{\}}
1044610446 for the overloads with no parameters by those names;
1044710447\item
10448- $M$ be \tcode{last1 - first1} plus the number of elements in \range{first2}{last2}
10449- that are not present in \range{first1}{last1};
10448+ $M$ be the number of elements in the sorted union (see below);
1045010449\item
1045110450 \tcode{result_last} be \tcode{result + $M$}
1045210451 for the overloads with no parameter \tcode{result_last} or \tcode{result_r};
1046210461
1046310462\pnum
1046410463\effects
10465- Constructs a sorted union of $N$ elements from the two ranges;
10464+ Constructs a sorted union of the elements from the two ranges;
1046610465that is, the set of elements that are present in one or both of the ranges.
10466+ If \range{first1}{last1} contains $m$ elements
10467+ that are equivalent to each other and
10468+ \range{first2}{last2} contains $n$ elements that are equivalent to them,
10469+ then all $m$ elements from the first range
10470+ are included in the union, in order, and
10471+ then the final $\max(n - m, 0)$ elements from the second range
10472+ are included in the union, in order.
10473+ If, of those elements, $k$ elements from the first range
10474+ are copied to the output range,
10475+ then the first $\min(k, n)$ elements from the second range
10476+ are considered \term{skipped}.
10477+ Copies the first $N$ elements of the sorted union
10478+ to the range \range{result}{result + $N$}.
1046710479
1046810480\pnum
1046910481\returns
1047610488 for the overloads in namespace \tcode{ranges},
1047710489 if $N$ is equal to $M$.
1047810490\item
10479- Otherwise, \tcode{\{j1, j2 , result_last\}}
10491+ Otherwise, \tcode{\{first1 + $A$, first2 + $B$ , result_last\}}
1048010492 for the overloads in namespace \tcode{ranges},
10481- where the iterators \tcode{j1} and \tcode{j2}
10482- point to positions past the last copied or skipped elements
10493+ where $A$ and $B$ are the numbers of copied or skipped elements
1048310494 in \range{first1}{last1} and \range{first2}{last2}, respectively.
1048410495\end{itemize}
1048510496
1049110502\pnum
1049210503\remarks
1049310504Stable\iref{algorithm.stable}.
10494- If \range{first1}{last1} contains $m$ elements
10495- that are equivalent to each other and
10496- \range{first2}{last2} contains $n$ elements
10497- that are equivalent to them,
10498- then all $m$ elements from the first range
10499- are copied to the output range, in order, and
10500- then the final $\max(n - m, 0)$ elements from the second range
10501- are copied to the output range, in order.
1050210505\end{itemdescr}
1050310506
1050410507\rSec3[set.intersection]{\tcode{set_intersection}}
1057510578 and \tcode{proj1} and \tcode{proj2} be \tcode{identity\{\}}
1057610579 for the overloads with no parameters by those names;
1057710580\item
10578- $M$ be the number of elements in \range{first1}{last1}
10579- that are present in \range{first2}{last2};
10581+ $M$ be the number of elements in the sorted intersection (see below);
1058010582\item
1058110583 \tcode{result_last} be \tcode{result + $M$}
1058210584 for the overloads with no parameter \tcode{result_last} or \tcode{result_r};
1059210594
1059310595\pnum
1059410596\effects
10595- Constructs a sorted intersection of $N$ elements from the two ranges;
10597+ Constructs a sorted intersection of the elements from the two ranges;
1059610598that is, the set of elements that are present in both of the ranges.
10599+ If \range{first1}{last1} contains $m$ elements
10600+ that are equivalent to each other and
10601+ \range{first2}{last2} contains $n$ elements
10602+ that are equivalent to them,
10603+ the first $\min(m, n)$ elements from the first range
10604+ are included in the sorted intersection.
10605+ If, of those elements, $k$ elements from the first range
10606+ are copied to the output range,
10607+ then the first $k$ elements from the second range
10608+ are considered \term{skipped}.
10609+ If $N < M$, a non-copied element is also considered skipped
10610+ if it compares less than the $(N + 1)^\text{th}$ element
10611+ of the sorted intersection.
10612+ Copies the first $N$ elements of the sorted intersection
10613+ to the range \range{result}{result + $N$}.
1059710614
1059810615\pnum
1059910616\returns
1060610623 for the overloads in namespace \tcode{ranges},
1060710624 if $N$ is equal to $M$.
1060810625\item
10609- Otherwise, \tcode{\{j1, j2 , result_last\}}
10626+ Otherwise, \tcode{\{first1 + $A$, first2 + $B$ , result_last\}}
1061010627 for the overloads in namespace \tcode{ranges},
10611- where the iterators \tcode{j1} and \tcode{j2}
10612- point to positions past the last copied or skipped elements
10628+ where $A$ and $B$ are the numbers of copied or skipped elements
1061310629 in \range{first1}{last1} and \range{first2}{last2}, respectively.
1061410630\end{itemize}
1061510631
1062110637\pnum
1062210638\remarks
1062310639Stable\iref{algorithm.stable}.
10624- If \range{first1}{last1} contains $m$ elements
10625- that are equivalent to each other and
10626- \range{first2}{last2} contains $n$ elements
10627- that are equivalent to them,
10628- the first $\min(m, n)$ elements
10629- are copied from the first range to the output range, in order.
1063010640\end{itemdescr}
1063110641
1063210642\rSec3[set.difference]{\tcode{set_difference}}
1070210712 and \tcode{proj1} and \tcode{proj2} be \tcode{identity\{\}}
1070310713 for the overloads with no parameters by those names;
1070410714\item
10705- $M$ be the number of elements in \range{first1}{last1}
10706- that are not present in \range{first2}{last2};
10715+ $M$ be the number of elements in the sorted difference (see below);
1070710716\item
1070810717 \tcode{result_last} be \tcode{result + $M$}
1070910718 for the overloads with no parameter \tcode{result_last} or \tcode{result_r};
@@ -10719,10 +10728,17 @@
1071910728
1072010729\pnum
1072110730\effects
10722- Copies $N$ elements of the range \range{first1}{last1}
10723- which are not present in the range \range{first2}{last2}
10731+ Constructs a sorted difference between the elements from the two ranges;
10732+ that is, the set of elements that are present
10733+ in the range \range{first1}{last1} but not \range{first2}{last2}.
10734+ If \range{first1}{last1} contains $m$ elements
10735+ that are equivalent to each other and
10736+ \range{first2}{last2} contains $n$ elements
10737+ that are equivalent to them,
10738+ the last $\max(m - n, 0)$ elements from \range{first1}{last1}
10739+ are included in the sorted difference, in order.
10740+ Copies the first $N$ elements of the sorted difference
1072410741to the range \range{result}{result + $N$}.
10725- The elements in the constructed range are sorted.
1072610742
1072710743\pnum
1072810744\returns
1073810754 Otherwise, \tcode{\{j1, result_last\}}
1073910755 for the overloads in namespace \tcode{ranges},
1074010756 where the iterator \tcode{j1}
10741- points to the position past the last copied or skipped element
10742- in \range{first1}{last1} .
10757+ points to the position of the element in \range{first1}{last1}
10758+ corresponding to the $(N + 1)^\text{th}$ element of the sorted difference .
1074310759\end{itemize}
1074410760
1074510761\pnum
1074910765
1075010766\pnum
1075110767\remarks
10752- If \range{first1}{last1} contains $m$ elements
10753- that are equivalent to each other and
10754- \range{first2}{last2} contains $n$ elements
10755- that are equivalent to them,
10756- the last $\max(m - n, 0)$ elements from \range{first1}{last1}
10757- are copied to the output range, in order.
10768+ Stable\iref{algorithm.stable}.
1075810769\end{itemdescr}
1075910770
1076010771\rSec3[set.symmetric.difference]{\tcode{set_symmetric_difference}}
@@ -10833,14 +10844,12 @@
1083310844 and \tcode{proj1} and \tcode{proj2} be \tcode{identity\{\}}
1083410845 for the overloads with no parameters by those names;
1083510846\item
10836- $K$ be the number of elements in \range{first1}{last1} that are not present in \range{first2}{last2}.
10837- \item
10838- $M$ be the number of elements in \range{first2}{last2} that are not present in \range{first1}{last1}.
10847+ $M$ be the number of elements in the sorted symmetric difference (see below);
1083910848\item
10840- \tcode{result_last} be \tcode{result + $M$ + $K$ }
10849+ \tcode{result_last} be \tcode{result + $M$}
1084110850 for the overloads with no parameter \tcode{result_last} or \tcode{result_r};
1084210851\item
10843- $N$ be $\min(K + M, \ \tcode{result_last - result})$.
10852+ $N$ be $\min(M, \ \tcode{result_last - result})$.
1084410853\end{itemize}
1084510854
1084610855\pnum
@@ -10851,12 +10860,24 @@
1085110860
1085210861\pnum
1085310862\effects
10854- Copies the elements of the range \range{first1}{last1}
10855- that are not present in the range \range{first2}{last2},
10856- and the elements of the range \range{first2}{last2}
10857- that are not present in the range \range{first1}{last1}
10863+ Constructs a sorted symmetric difference of the elements from the two ranges;
10864+ that is, the set of elements that are present
10865+ in exactly one of \range{first1}{last1} and \range{first2}{last2}.
10866+ If \range{first1}{last1} contains $m$ elements
10867+ that are equivalent to each other and
10868+ \range{first2}{last2} contains $n$ elements
10869+ that are equivalent to them,
10870+ then $|m - n|$ of those elements are included in the symmetric difference:
10871+ the last $m - n$ of these elements from \range{first1}{last1},
10872+ in order, if $m > n$, and
10873+ the last $n - m$ of these elements from \range{first2}{last2},
10874+ in order, if $m < n$.
10875+ If $N < M$, a non-copied element is considered \term{skipped}
10876+ if it compares less than or equivalent to the $(N + 1)^\text{th}$ element
10877+ of the sorted symmetric difference,
10878+ unless it is from the same range as that element and does not precede it.
10879+ Copies the first $N$ elements of the sorted symmetric difference
1085810880to the range \range{result}{result + $N$}.
10859- The elements in the constructed range are sorted.
1086010881
1086110882\pnum
1086210883\returns
1086910890 for the overloads in namespace \tcode{ranges},
1087010891 if $N$ is equal to $M + K$.
1087110892\item
10872- Otherwise, \tcode{\{j1, j2 , result_last\}}
10893+ Otherwise, \tcode{\{first1 + $A$, first2 + $B$ , result_last\}}
1087310894 for the overloads in namespace \tcode{ranges},
10874- where the iterators \tcode{j1} and \tcode{j2}
10875- point to positions past the last copied or skipped elements
10895+ where $A$ and $B$ are the numbers of copied or skipped elements
1087610896 in \range{first1}{last1} and \range{first2}{last2}, respectively.
1087710897\end{itemize}
1087810898
1088410904\pnum
1088510905\remarks
1088610906Stable\iref{algorithm.stable}.
10887- If \range{first1}{last1} contains $m$ elements
10888- that are equivalent to each other and
10889- \range{first2}{last2} contains $n$ elements
10890- that are equivalent to them,
10891- then $|m - n|$ of those elements shall be copied to the output range:
10892- the last $m - n$ of these elements from \range{first1}{last1} if $m > n$, and
10893- the last $n - m$ of these elements from \range{first2}{last2} if $m < n$.
10894- In either case, the elements are copied in order.
1089510907\end{itemdescr}
1089610908
1089710909\rSec2[alg.heap.operations]{Heap operations}
0 commit comments