STL: merge
merge
Combines all of the elements from two sorted source ranges into a single, sorted destination range, where the ordering criterion may be specified by a binary predicate.
template<class InputIterator1, class InputIterator2, class OutputIterator> OutputIterator merge( InputIterator1 _First1, InputIterator1 _Last1, InputIterator2 _First2, InputIterator2 _Last2, OutputIterator _Result ); template<class InputIterator1, class InputIterator2, class OutputIterator, class BinaryPredicate> OutputIterator merge( InputIterator1 _First1, InputIterator1 _Last1, InputIterator2 _First2, InputIterator2 _Last2, OutputIterator _Result BinaryPredicate _Comp );