Luna::List::merge
template <typename _Compare>
void merge(List &&other, _Compare comp)
Merges another list into this list.
No memory allocation or element copy/move will be performed, this function transfers elements by changing their pointers directly so that they link to the new list. Elements are compared using the user-specified comparison function object.
Parameters
-
in other
The list to merge. This list will be empty after this operation. If this is equal to
*this, this function does nothing. -
in comp
The comparison function object to use.
Valid Usage
-
compmust provide the following function:bool operator()(const _Ty& a, const _Ty& b), that returnstrueifashould appear in the list beforeb. -
Elements in
*thisandothermust be sorted in an order defined by the user-specified comparison function, that is, for any two elementsaandbin the same list,comp(b, a)must returnfalseifaappears beforeb.