void merge(list& x);
void merge(list& x, greater<T> pr);
Both member functions remove all elements from the sequence controlled by x
and insert them into the controlled
sequence. Both sequences must be ordered by the same predicate, described below. The resulting sequence is also
ordered by that predicate.
For the iterators Pi
and Pj
designating elements at positions i
and j
, the first member function imposes the order
!(*Pj < *Pi)
whenever i < j
. (The elements are sorted in ascending order.) The second member function
imposes the order !pr(*Pj, *Pi)
whenever i < j
.
No pairs of elements in the original controlled sequence are reversed in the resulting controlled sequence. If a pair of
elements in the resulting controlled sequence compares equal (!(*Pi < *Pj) && !(*Pj < *Pi)
), an element from
the original controlled sequence appears before an element from the sequence controlled by x
.
In this implementation, if a translator does not support member template functions, the template:
template<class Pred>
void merge(list& x, Pred pr);
is replaced by:
void
merge
(list& x,
greater
<T> pr);