Template Struct minimum¶
Defined in File functional.h
Struct Documentation¶
-
template<typename
T
>
structminimum
¶ minimum
is a function object that takes two arguments and returns the lesser of the two. Specifically, it is an Adaptable Binary Function. Iff
is an object of classminimum<T>
andx
andy
are objects of classT
f(x,y)
returnsx
ifx < y
andy
, otherwise.The following code snippet demonstrates that
minimum
returns its lesser argument.- Template Parameters
T
: is a model of LessThan Comparable.
#include <thrust/functional.h> #include <assert.h> ... int x = 137; int y = -137; thrust::minimum<int> mn; assert(y == mn(x,y));
- See
- See
max
- See
Public Types
-
typedef
first_argument_type
¶ The type of the function object’s first argument.
-
typedef
second_argument_type
¶ The type of the function object’s second argument.
-
typedef
result_type
¶ The type of the function object’s result;.
Public Functions
-
__host__ __device__ T thrust::minimum::operator()(const T & lhs, const T & rhs) const
Function call operator. The return value is
lhs < rhs ? lhs : rhs
.