| Home | Libraries | People | FAQ | More

## Function template merge

boost::compute::merge

## Synopsis

    // In header: <boost/compute/algorithm/merge.hpp>

    template<typename InputIterator1, typename InputIterator2,
             typename OutputIterator, typename Compare>
      OutputIterator
      merge(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2,
            InputIterator2 last2, OutputIterator result, Compare comp,
            command_queue & queue = system::default_queue());

## Description

Merges the sorted values in the range [`first1`, `last1`) with the sorted values in the range [`first2`, last2) and stores the result in the range beginning at `result`. Values are compared using the `comp` function. If no comparision function is given, `less` is used.

Space complexity: \Omega(distance(`first1`, `last1`) + distance(`first2`, `last2`))

See Also:

inplace_merge()

Parameters: |
`comp` | comparison function (by default `less`)
`first1` | first element in the first range to merge
`first2` | first element in the second range to merge
`last1` | last element in the first range to merge
`last2` | last element in the second range to merge
`queue` | command queue to perform the operation
`result` | first element in the result range
Returns: | `OutputIterator` to the end of the result range