Search on this site

 Template Algorithms For Sorted Sets

template <class C, class L> C& AppendSorted(C& dest, const C& src, const L& less)

Merges source NTL container to destination NTL container. Both containers must be sorted in ascending order. After the operation, destination container is sorted in ascending order and contains values from both containers. Duplicate values are preserved. Ordering predicate is determined by less.

 C Type of container.
 dest Destination container.
 src Source container.
 less Ordering predicate.
 Return value Destination container.template

template <class C> C& AppendSorted(C& dest, const C& src)

Merges source NTL container to destination NTL container. Both containers must be sorted in ascending order. After the operation, destination container is sorted in ascending order and contains values from both containers. Duplicate values are preserved. Ordering is determined by operator<.

 C Type of container.
 dest Destination container.
 src Source container.
 Return value Destination container.template

template <class C, class L> C& UnionSorted(C& dest, const C& src, const L& less)

Merges source NTL container to destination NTL container. Both containers must be sorted in ascending order and values must be unique. After the operation, destination container is sorted in ascending order and contains unique values from both containers. Ordering is determined by less.

 C Type of container.
 dest Destination container.
 src Source container.
 less Ordering predicate.
 Return value Destination container.

template <class C> C& UnionSorted(C& dest, const C& src)

Merges the source NTL container to the destination NTL container. Both containers must be sorted in ascending order and values must be unique. After the operation, destination container is sorted in ascending order and contains unique values from both containers. Ordering is determined by operator<.

 C Type of container.
 dest Destination container.
 src Source container.
 Return value Destination container.

template <class C, class L> C& RemoveSorted(C& from, const C& what, const L& less)

Removes elements of source container from destination container. Both containers must be sorted in ascending order and values must be unique. Ordering is determined by less.

 C Type of container.
 from Destination container.
 what Source container.
 less Ordering predicate.
 Return value Destination container.

template <class C> C& RemoveSorted(C& from, const C& what)

Removes elements of source container from destination container. Both containers must be sorted in ascending order and values must be unique. Ordering is determined by operator<.

 C Type of container.
 from Destination container.
 what Source container.
 Return value Destination container.

template <class D, class S, class L> D& IntersectSorted(D& dest, const S& src, const L& less)

Removes elements from destination container that are not contained in source container. Both containers must be sorted in ascending order and values must be unique. Ordering is determined by less.

 D Type of destination container.
 S Type of source container.
 dest Destination container.
 src Source container.
 less Destination container.

template <class D, class S> D& IntersectSorted(D& dest, const S& src)

Removes elements from destination container that are not contained in source container. Both containers must be sorted in ascending order and values must be unique. Ordering is determined by operator<.

 D Type of destination container.
 S Type of source container.
 dest Destination container.
 src Source container.
 Return value Destination container.

 Last edit by cxl on 12/02/2017. Do you want to contribute?. T++