1042510425 and \tcode{proj1} and \tcode{proj2} be \tcode{identity\{\}}
1042610426 for the overloads with no parameters by those names;
1042710427\item
10428- $M$ be \tcode{last1 - first1} plus the number of elements in \range{first2}{last2}
10429- that are not present in \range{first1}{last1};
10428+ $M$ be the number of elements in the sorted union (see below);
1043010429\item
1043110430 \tcode{result_last} be \tcode{result + $M$}
1043210431 for the overloads with no parameter \tcode{result_last} or \tcode{result_r};
1044210441
1044310442\pnum
1044410443\effects
10445- Constructs a sorted union of $N$ elements from the two ranges;
10444+ Constructs a sorted union of the elements from the two ranges;
1044610445that is, the set of elements that are present in one or both of the ranges.
10446+ If \range{first1}{last1} contains $m$ elements
10447+ that are equivalent to each other and
10448+ \range{first2}{last2} contains $n$ elements that are equivalent to them,
10449+ then all $m$ elements from the first range
10450+ are included in the union, in order, and
10451+ then the final $\max(n - m,0)$ elements from the second range
10452+ are included in the union, in order.
10453+ If, of those elements, $k$ elements from the first range
10454+ are copied to the output range,
10455+ then the first $\min(k,n)$ elements from the second range
10456+ are considered \term{skipped}.
10457+ Copies the first $N$ elements of the sorted union
10458+ to the range \range{result}{result + $N$}.
1044710459
1044810460\pnum
1044910461\returns
1045610468 for the overloads in namespace \tcode{ranges},
1045710469 if $N$ is equal to $M$.
1045810470\item
10459- Otherwise, \tcode{\{j1, j2 , result_last\}}
10471+ Otherwise, \tcode{\{first1 + $A$, first2 + $B$ , result_last\}}
1046010472 for the overloads in namespace \tcode{ranges},
10461- where the iterators \tcode{j1} and \tcode{j2}
10462- point to positions past the last copied or skipped elements
10473+ where $A$ and $B$ are the numbers of copied or skipped elements
1046310474 in \range{first1}{last1} and \range{first2}{last2}, respectively.
1046410475\end{itemize}
1046510476
1047110482\pnum
1047210483\remarks
1047310484Stable\iref{algorithm.stable}.
10474- If \range{first1}{last1} contains $m$ elements
10475- that are equivalent to each other and
10476- \range{first2}{last2} contains $n$ elements
10477- that are equivalent to them,
10478- then all $m$ elements from the first range
10479- are copied to the output range, in order, and
10480- then the final $\max(n - m, 0)$ elements from the second range
10481- are copied to the output range, in order.
1048210485\end{itemdescr}
1048310486
1048410487\rSec3[set.intersection]{\tcode{set_intersection}}
1055510558 and \tcode{proj1} and \tcode{proj2} be \tcode{identity\{\}}
1055610559 for the overloads with no parameters by those names;
1055710560\item
10558- $M$ be the number of elements in \range{first1}{last1}
10559- that are present in \range{first2}{last2};
10561+ $M$ be the number of elements in the sorted intersection (see below);
1056010562\item
1056110563 \tcode{result_last} be \tcode{result + $M$}
1056210564 for the overloads with no parameter \tcode{result_last} or \tcode{result_r};
1057210574
1057310575\pnum
1057410576\effects
10575- Constructs a sorted intersection of $N$ elements from the two ranges;
10577+ Constructs a sorted intersection of the elements from the two ranges;
1057610578that is, the set of elements that are present in both of the ranges.
10579+ If \range{first1}{last1} contains $m$ elements
10580+ that are equivalent to each other and
10581+ \range{first2}{last2} contains $n$ elements
10582+ that are equivalent to them,
10583+ the first $\min(m, n)$ elements
10584+ are included in the sorted intersection.
10585+ If, of those elements, $k$ elements from the first range
10586+ are copied to the output range,
10587+ then the first $k$ elements from the second range
10588+ are considered \term{skipped}.
10589+ If $N < M$, a non-copied element is also considered skipped
10590+ if it compares less than the $(N+1)^\text{th}$ element
10591+ of the sorted intersection.
10592+ Copies the first $N$ elements of the sorted intersection
10593+ to the range \range{result}{result + $N$}.
1057710594
1057810595\pnum
1057910596\returns
1058610603 for the overloads in namespace \tcode{ranges},
1058710604 if $N$ is equal to $M$.
1058810605\item
10589- Otherwise, \tcode{\{j1, j2 , result_last\}}
10606+ Otherwise, \tcode{\{first1 + $A$, first2 + $B$ , result_last\}}
1059010607 for the overloads in namespace \tcode{ranges},
10591- where the iterators \tcode{j1} and \tcode{j2}
10592- point to positions past the last copied or skipped elements
10608+ where $A$ and $B$ are the numbers of copied or skipped elements
1059310609 in \range{first1}{last1} and \range{first2}{last2}, respectively.
1059410610\end{itemize}
1059510611
1060110617\pnum
1060210618\remarks
1060310619Stable\iref{algorithm.stable}.
10604- If \range{first1}{last1} contains $m$ elements
10605- that are equivalent to each other and
10606- \range{first2}{last2} contains $n$ elements
10607- that are equivalent to them,
10608- the first $\min(m, n)$ elements
10609- are copied from the first range to the output range, in order.
1061010620\end{itemdescr}
1061110621
1061210622\rSec3[set.difference]{\tcode{set_difference}}
1068210692 and \tcode{proj1} and \tcode{proj2} be \tcode{identity\{\}}
1068310693 for the overloads with no parameters by those names;
1068410694\item
10685- $M$ be the number of elements in \range{first1}{last1}
10686- that are not present in \range{first2}{last2};
10695+ $M$ be the number of elements in the sorted difference (see below);
1068710696\item
1068810697 \tcode{result_last} be \tcode{result + $M$}
1068910698 for the overloads with no parameter \tcode{result_last} or \tcode{result_r};
@@ -10699,10 +10708,17 @@
1069910708
1070010709\pnum
1070110710\effects
10702- Copies $N$ elements of the range \range{first1}{last1}
10703- which are not present in the range \range{first2}{last2}
10711+ Constructs a sorted difference between the elements from the two ranges;
10712+ that is, the set of elements that are present
10713+ in the range \range{first1}{last1} but not \range{first2}{last2}.
10714+ If \range{first1}{last1} contains $m$ elements
10715+ that are equivalent to each other and
10716+ \range{first2}{last2} contains $n$ elements
10717+ that are equivalent to them,
10718+ the last $\max(m - n, 0)$ elements from \range{first1}{last1}
10719+ are included in the sorted difference, in order.
10720+ Copies the first $N$ elements of the sorted difference
1070410721to the range \range{result}{result + $N$}.
10705- The elements in the constructed range are sorted.
1070610722
1070710723\pnum
1070810724\returns
1071810734 Otherwise, \tcode{\{j1, result_last\}}
1071910735 for the overloads in namespace \tcode{ranges},
1072010736 where the iterator \tcode{j1}
10721- points to the position past the last copied or skipped element
10722- in \range{first1}{last1} .
10737+ points to the position of the element in \range{first1}{last1}
10738+ corresponding to the $(N+1)^\text{th}$ element of the sorted difference .
1072310739\end{itemize}
1072410740
1072510741\pnum
1072910745
1073010746\pnum
1073110747\remarks
10732- If \range{first1}{last1} contains $m$ elements
10733- that are equivalent to each other and
10734- \range{first2}{last2} contains $n$ elements
10735- that are equivalent to them,
10736- the last $\max(m - n, 0)$ elements from \range{first1}{last1}
10737- are copied to the output range, in order.
10748+ Stable\iref{algorithm.stable}.
1073810749\end{itemdescr}
1073910750
1074010751\rSec3[set.symmetric.difference]{\tcode{set_symmetric_difference}}
@@ -10813,14 +10824,12 @@
1081310824 and \tcode{proj1} and \tcode{proj2} be \tcode{identity\{\}}
1081410825 for the overloads with no parameters by those names;
1081510826\item
10816- $K$ be the number of elements in \range{first1}{last1} that are not present in \range{first2}{last2}.
10817- \item
10818- $M$ be the number of elements in \range{first2}{last2} that are not present in \range{first1}{last1}.
10827+ $M$ be the number of elements in the sorted symmetric difference (see below);
1081910828\item
10820- \tcode{result_last} be \tcode{result + $M$ + $K$ }
10829+ \tcode{result_last} be \tcode{result + $M$}
1082110830 for the overloads with no parameter \tcode{result_last} or \tcode{result_r};
1082210831\item
10823- $N$ be $\min(K + M, \ \tcode{result_last - result})$.
10832+ $N$ be $\min(M, \ \tcode{result_last - result})$.
1082410833\end{itemize}
1082510834
1082610835\pnum
@@ -10831,12 +10840,24 @@
1083110840
1083210841\pnum
1083310842\effects
10834- Copies the elements of the range \range{first1}{last1}
10835- that are not present in the range \range{first2}{last2},
10836- and the elements of the range \range{first2}{last2}
10837- that are not present in the range \range{first1}{last1}
10843+ Constructs a sorted symmetric difference of the elements from the two ranges;
10844+ that is, the set of elements that are present
10845+ in exactly one of \range{first1}{last1} and \range{first2}\range{last2}.
10846+ If \range{first1}{last1} contains $m$ elements
10847+ that are equivalent to each other and
10848+ \range{first2}{last2} contains $n$ elements
10849+ that are equivalent to them,
10850+ then $|m - n|$ of those elements are included in the symmetric difference:
10851+ the last $m - n$ of these elements from \range{first1}{last1},
10852+ in order, if $m > n$, and
10853+ the last $n - m$ of these elements from \range{first2}{last2},
10854+ in order, if $m < n$.
10855+ If $N < M$, a non-copied element is considered \term{skipped}
10856+ if it compares less than or equivalent to the $(N+1)^\text{th}$ element
10857+ of the sorted symmetric difference,
10858+ unless it is from the same range as that element and does not precede it.
10859+ Copies the first $N$ elements of the sorted symmetric difference
1083810860to the range \range{result}{result + $N$}.
10839- The elements in the constructed range are sorted.
1084010861
1084110862\pnum
1084210863\returns
1084910870 for the overloads in namespace \tcode{ranges},
1085010871 if $N$ is equal to $M + K$.
1085110872\item
10852- Otherwise, \tcode{\{j1, j2 , result_last\}}
10873+ Otherwise, \tcode{\{first1 + $A$, first2 + $B$ , result_last\}}
1085310874 for the overloads in namespace \tcode{ranges},
10854- where the iterators \tcode{j1} and \tcode{j2}
10855- point to positions past the last copied or skipped elements
10875+ where $A$ and $B$ are the numbers of copied or skipped elements
1085610876 in \range{first1}{last1} and \range{first2}{last2}, respectively.
1085710877\end{itemize}
1085810878
1086410884\pnum
1086510885\remarks
1086610886Stable\iref{algorithm.stable}.
10867- If \range{first1}{last1} contains $m$ elements
10868- that are equivalent to each other and
10869- \range{first2}{last2} contains $n$ elements
10870- that are equivalent to them,
10871- then $|m - n|$ of those elements shall be copied to the output range:
10872- the last $m - n$ of these elements from \range{first1}{last1} if $m > n$, and
10873- the last $n - m$ of these elements from \range{first2}{last2} if $m < n$.
10874- In either case, the elements are copied in order.
1087510887\end{itemdescr}
1087610888
1087710889\rSec2[alg.heap.operations]{Heap operations}
0 commit comments