thrust

◆ THRUST_PREVENT_MACRO_SUBSTITUTION() [2/4]

template<typename T >
__host__ __device__ T min thrust::THRUST_PREVENT_MACRO_SUBSTITUTION ( const T &  lhs,
const T &  rhs 
)

This version of min returns the smaller of two values.

Parameters
lhsThe first value to compare.
rhsThe second value to compare.
Returns
The smaller element.
Template Parameters
Tis a model of LessThan Comparable.

The following code snippet demonstrates how to use min to compute the smaller of two integers.

#include <thrust/extrema.h>
...
int a = 13;
int b = 7;
int smaller = thrust::min(a, b);
// smaller is 7
Note
Returns the first argument when the arguments are equivalent.
See also
max