Bolt
1.3
C++ template library with support for OpenCL
|
Functions | |
template<typename RandomAccessIterator > | |
void | bolt::amp::stable_sort (RandomAccessIterator first, RandomAccessIterator last) |
template<typename RandomAccessIterator , typename StrictWeakOrdering > | |
void | bolt::amp::stable_sort (RandomAccessIterator first, RandomAccessIterator last, StrictWeakOrdering comp) |
template<typename RandomAccessIterator > | |
void | bolt::amp::stable_sort (bolt::amp::control &ctl, RandomAccessIterator first, RandomAccessIterator last) |
template<typename RandomAccessIterator , typename StrictWeakOrdering > | |
void | bolt::amp::stable_sort (bolt::amp::control &ctl, RandomAccessIterator first, RandomAccessIterator last, StrictWeakOrdering comp) |
void bolt::amp::stable_sort | ( | RandomAccessIterator | first, |
RandomAccessIterator | last | ||
) |
Stable_sort
returns the sorted result of all the elements in the range specified between the the first and last RandomAccessIterator
iterators. This routine arranges the elements in ascending order assuming that an operator < exists for the value_type given by the iterator.
The stable_sort
operation is analogus to the std::stable_sort function. It is a stable operation with respect to the input data, in that if two elements are equivalent in the input range, and element X appears before element Y, then element X has to maintain that relationship and appear before element Y after the sorting operation. In general, stable sorts are usually prefered over unstable sorting algorithms, but may sacrifice a little performance to maintain this relationship.
first | Defines the beginning of the range to be sorted |
last | Defines the end of the range to be sorted |
RandomAccessIterator | models a random access iterator The following code example shows the use of \p stable_sort to sort the elements in ascending order #include "bolt/amp/stablesort.h"
int a[ 10 ] = { 2, 9, 3, 7, 5, 6, 3, 8, 9, 0 };
bolt::amp::stable_sort( a, a + 10 );
\\ results a[] = { 0, 2, 3, 3, 5, 6, 7, 8, 9, 9 }
\\ The 3s and the 9s kept their respective ordering from the original input
|
void bolt::amp::stable_sort | ( | RandomAccessIterator | first, |
RandomAccessIterator | last, | ||
StrictWeakOrdering | comp | ||
) |
Stable_sort
returns the sorted result of all the elements in the range specified between the the first and last RandomAccessIterator
iterators. This routine arranges the elements in ascending order assuming that an operator < exists for the value_type given by the iterator.
The stable_sort
operation is analogus to the std::stable_sort function. It is a stable operation with respect to the input data, in that if two elements are equivalent in the input range, and element X appears before element Y, then element X has to maintain that relationship and appear before element Y after the sorting operation. In general, stable sorts are usually prefered over unstable sorting algorithms, but may sacrifice a little performance to maintain this relationship. This overload of stable_sort accepts an additional comparator functor that allows the user to specify the comparison operator to use.
first | Defines the beginning of the range to be sorted |
last | Defines the end of the range to be sorted |
comp | A user defined comparison function or functor that models a strict weak < operator |
RandomAccessIterator | models a random access iterator |
StrictWeakOrdering | models a binary predicate which returns true if the first element is 'less than' the second The following code example shows the use of \p stable_sort to sort the elements in ascending order #include "bolt/amp/stablesort.h"
int a[ 10 ] = { 2, 9, 3, 7, 5, 6, 3, 8, 9, 0 };
bolt::amp::stable_sort( a, a + 10, bolt::amp::greater< int >( ) );
\\ results a[] = { 9, 9, 8, 7, 6, 5, 3, 3, 2, 0 }
|
void bolt::amp::stable_sort | ( | bolt::amp::control & | ctl, |
RandomAccessIterator | first, | ||
RandomAccessIterator | last | ||
) |
Stable_sort
returns the sorted result of all the elements in the range specified between the the first and last RandomAccessIterator
iterators. This routine arranges the elements in ascending order assuming that an operator < exists for the value_type given by the iterator.
The stable_sort
operation is analogus to the std::stable_sort function. It is a stable operation with respect to the input data, in that if two elements are equivalent in the input range, and element X appears before element Y, then element X has to maintain that relationship and appear before element Y after the sorting operation. In general, stable sorts are usually prefered over unstable sorting algorithms, but may sacrifice a little performance to maintain this relationship. This overload of stable_sort accepts an additional bolt::amp::control object that allows the user to change the state that the function uses to make runtime decisions.
ctl | A control object passed into stable_sort that the function uses to make runtime decisions |
first | Defines the beginning of the range to be sorted |
last | Defines the end of the range to be sorted |
RandomAccessIterator | models a random access iterator The following code example shows the use of \p stable_sort to sort the elements in ascending order #include "bolt/amp/stablesort.h"
int a[ 10 ] = { 2, 9, 3, 7, 5, 6, 3, 8, 9, 0 };
bolt::amp::stable_sort( bolt::amp::control::getDefault( ), a, a + 10 );
\\ results a[] = { 9, 9, 8, 7, 6, 5, 3, 3, 2, 0 }
|
void bolt::amp::stable_sort | ( | bolt::amp::control & | ctl, |
RandomAccessIterator | first, | ||
RandomAccessIterator | last, | ||
StrictWeakOrdering | comp | ||
) |
Stable_sort
returns the sorted result of all the elements in the range specified between the the first and last RandomAccessIterator
iterators. This routine arranges the elements in ascending order assuming that an operator < exists for the value_type given by the iterator.
The stable_sort
operation is analogus to the std::stable_sort function. It is a stable operation with respect to the input data, in that if two elements are equivalent in the input range, and element X appears before element Y, then element X has to maintain that relationship and appear before element Y after the sorting operation. In general, stable sorts are usually prefered over unstable sorting algorithms, but may sacrifice a little performance to maintain this relationship. This overload of stable_sort accepts an additional comparator functor that allows the user to specify the comparison operator to use. This overload also accepts an additional bolt::amp::control object that allows the user to change the state that the function uses to make runtime decisions.
ctl | A control object passed into stable_sort that the function uses to make runtime decisions |
first | Defines the beginning of the range to be sorted |
last | Defines the end of the range to be sorted |
comp | A user defined comparison function or functor that models a strict weak < operator |
RandomAccessIterator | models a random access iterator |
StrictWeakOrdering | models a binary predicate which returns true if the first element is 'less than' the second The following code example shows the use of \p stable_sort to sort the elements in ascending order #include "bolt/amp/stablesort.h"
int a[ 10 ] = { 2, 9, 3, 7, 5, 6, 3, 8, 9, 0 };
bolt::amp::stable_sort( bolt::amp::control::getDefault( ), a, a + 10, bolt::amp::greater< int >( ) );
\\ results a[] = { 9, 9, 8, 7, 6, 5, 3, 3, 2, 0 }
|