Public Types | Public Member Functions | List of all members
thrust::plus< 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__ constexpr T operator() (const T &lhs, const T &rhs) const

Detailed Description

template<typename T = void>
struct thrust::plus< T >

plus is a function object. Specifically, it is an Adaptable Binary Function. If f is an object of class plus<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 plus to sum two device_vectors of floats.

#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 {76, 77, 78, ..., 1075}
See also

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