Template Struct maximum

Struct Documentation

template<typename T>
struct maximum

maximum is a function object that takes two arguments and returns the greater of the two. Specifically, it is an Adaptable Binary Function. If f is an object of class maximum<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

maximum returns its greater argument.
Template Parameters

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

See

minimum

See

min

See

binary_function

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::maximum::operator()(const T & lhs, const T & rhs) const

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