*Preconditions*

*Preconditions*

For the first version:

*• [first1, last1)* is a valid range.

*• [first2, last2)* is a valid range.

*• [first1, last1)* is ordered in ascending order according to *operator<*. That is, for every pair of iterators *i* and *j* in *[first1, last1)* such that *i* precedes *j*, **j < *i* is *false*.

*• [first2, last2)* is ordered in ascending order according to *operator<*. That is, for every pair of iterators *i* and *j* in *[first2, last2)* such that *i* precedes *j*, **j < *i* is *false*.

• There is enough space to hold all of the elements being copied. More formally, the requirement is that *[result, result + n)* is a valid range, where *n* is the number of elements in the union of the two input ranges.

*• [first1, last1)* and *[result, result + n)* do not overlap.

*• [first2, last2)* and *[result, result + n)* do not overlap.

For the second version:

*• [first1, last1)* is a valid range.

*• [first2, last2)* is a valid range.

*• [first1, last1)* is ordered in ascending order according to *comp*. That is, for every pair of iterators *i* and *j* in *[first1, last1)* such that *i* precedes *j*, *comp(*j, *i)* is *false*.

*• [first2, last2)* is ordered in ascending order according to *comp*. That is, for every pair of iterators *i* and *j* in *[first2, last2)* such that *i* precedes *j*, *comp(*j, *i)* is *false*.

• There is enough space to hold all of the elements being copied. More formally, the requirement is that *[result, result + n)* is a valid range, where *n* is the number of elements in the union of the two input ranges.

*• [first1, last1)* and *[result, result + n)* do not overlap.

*• [first2, last2)* and *[result, result + n)* do not overlap.