Public Types | Public Member Functions | List of all members
thrust::divides< T > Struct Template Reference

#include <thrust/functional.h>

Public Types

typedef T first_argument_type
 The type of the function object's first argument.
typedef T second_argument_type
 The type of the function object's second argument.
typedef T result_type
 The type of the function object's result;.

Public Member Functions

__thrust_exec_check_disable__ __host__ __device__ T operator() (const T &lhs, const T &rhs) const

Detailed Description

template<typename T>
struct thrust::divides< T >

divides is a function object. Specifically, it is an Adaptable Binary Function. If f is an object of class divides<T>, and x and y are objects of class T, then f(x,y) returns x/y.

Template Parameters
Tis a model of Assignable, and if x and y are objects of type T, then x/y must be defined and must have a return type that is convertible to T.

The following code snippet demonstrates how to use divides to divide one device_vectors of floats by another.

#include <thrust/fill.h>
const int N = 1000;
thrust::sequence(V1.begin(), V1.end(), 1);
thrust::fill(V2.begin(), V2.end(), 75);
thrust::transform(V1.begin(), V1.end(), V2.begin(), V3.begin(),
// V3 is now {1/75, 2/75, 3/75, ..., 1000/75}
See also

The documentation for this struct was generated from the following file: