thrust

◆ THRUST_PREVENT_MACRO_SUBSTITUTION() [4/4]

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

This version of max returns the larger of two values.

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

The following code snippet demonstrates how to use max to compute the larger of two integers.

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