thrust::minimum

Defined in thrust/functional.h

template<typename T = void>
struct minimum

minimum is a function object that takes two arguments and returns the lesser of the two. Specifically, it is an Adaptable Binary Function. If f is an object of class minimum<T> and x and y are objects of class T f(x,y) returns x if x < y and y, otherwise.

The following code snippet demonstrates that minimum returns its lesser argument.

#include <thrust/functional.h>
#include <assert.h>
...
int x =  137;
int y = -137;
thrust::minimum<int> mn;
assert(y == mn(x,y));

See also

maximum

See also

max

See also

binary_function

Template Parameters

T – is a model of LessThan Comparable.

Public Types

typedef T first_argument_type

The type of the function object’s first argument. deprecated [Since 2.6].

typedef T second_argument_type

The type of the function object’s second argument. deprecated [Since 2.6].

typedef T result_type

The type of the function object’s result; deprecated [Since 2.6].

Public Functions

inline constexpr T operator()(const T &lhs, const T &rhs) const

Function call operator. The return value is lhs < rhs ? lhs : rhs.