thrust::min

Defined in thrust/extrema.h

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

This version of min

returns the smaller of two values.

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

See also

max

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 smaller element.