thrust::max

Defined in thrust/extrema.h

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

This version of max

returns the larger of two values.

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

See also

min

Note

Returns the first argument when the arguments are equivalent.

Parameters
  • lhs – The first value to compare.

  • rhs – The second value to compare.

Template Parameters

T – is a model of LessThan Comparable.

Returns

The larger element.