Bolt  1.3
C++ template library with support for OpenCL
Functions
AMP-merge

Functions

template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator >
OutputIterator bolt::amp::merge (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result)
 merge returns the result of combining the two sorted range [first1, last1] and [first2, last2] in to a single sorted range [result , result + (last1-first1) + ( last2-first2)]
 
template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator >
OutputIterator bolt::amp::merge (bolt::amp::control &ctl, InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result)
 
template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator , typename StrictWeakCompare >
OutputIterator bolt::amp::merge (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, StrictWeakCompare comp)
 merge returns the result of combining the two sorted range [first1, last1] and [first2, last2] in to a single sorted range [result , result + (last1-first1) + ( last2-first2)]
 
template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator , typename StrictWeakCompare >
OutputIterator bolt::amp::merge (bolt::amp::control &ctl, InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, StrictWeakCompare comp)
 

Detailed Description

Function Documentation

template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator >
OutputIterator bolt::amp::merge ( InputIterator1  first1,
InputIterator1  last1,
InputIterator2  first2,
InputIterator2  last2,
OutputIterator  result 
)

merge returns the result of combining the two sorted range [first1, last1] and [first2, last2] in to a single sorted range [result , result + (last1-first1) + ( last2-first2)]

The merge operation is similar the std::merge function

Parameters
ctlOptional Control structure to control command-queue, debug, tuning.
first1The beginning of the first input range.
last1The end of the first input range.
first2The beginning of the second input range.
last2The end of the second input range.
Template Parameters
InputIterator1An iterator that can be dereferenced for an object, and can be incremented to get to the next element in a sequence.
InputIterator2An iterator that can be dereferenced for an object, and can be incremented to get to the next element in a sequence.
OutputIteratorisa model of Output Iterator
Returns
The beginning of the merge result

The following code example shows the use of merge operator.

#include <bolt/amp/merge.h>
int a[5] = {1,3, 5, 7, 9};
int b [5] = {2,4,6,8,10};
int r[10];
int *r_end = bolt::amp::merge(a, a+5,b,b+5,r);
// r = 1,2,3,4,5,6,7,8,9,10
See Also
http://www.sgi.com/tech/stl/merge.html
template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator , typename StrictWeakCompare >
OutputIterator bolt::amp::merge ( InputIterator1  first1,
InputIterator1  last1,
InputIterator2  first2,
InputIterator2  last2,
OutputIterator  result,
StrictWeakCompare  comp 
)

merge returns the result of combining the two sorted range [first1, last1] and [first2, last2] in to a single sorted range [result , result + (last1-first1) + ( last2-first2)]

The merge operation is similar the std::merge function

Parameters
ctlOptional Control structure to control command-queue, debug, tuning.
first1The beginning of the first input range.
last1The end of the first input range.
first2The beginning of the second input range.
last2The end of the second input range.
compComparison operator.
Template Parameters
InputIterator1An iterator that can be dereferenced for an object, and can be incremented to get to the next element in a sequence.
InputIterator2An iterator that can be dereferenced for an object, and can be incremented to get to the next element in a sequence.
OutputIteratorisa model of Output Iterator
StrictWeakCompareis a model of Strict Weak Ordering.
Returns
The beginning of the merge result.

The following code example shows the use of merge operator.

#include <bolt/amp/merge.h>
int a[5] = {9,7, 5, 3, 1};
int b [5] = {10,8,6,4,2};
int r[10];
int *r_end = bolt::amp::merge(a, a+5,b,b+5,r,bolt::amp::greater<int>());
// r = 10,9,8,7,6,5,4,3,2,1
See Also
http://www.sgi.com/tech/stl/merge.html