Thrust
|
#include <thrust/functional.h>
Public Types | |
typedef T | argument_type |
The type of the function object's 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 &x) const |
square
is a function object. Specifically, it is an Adaptable Unary Function. If f
is an object of class square<T>
, and x
is an object of class T
, then f(x)
returns x*x
.
T | is a model of Assignable, and if x is an object of type T , then x*x must be defined and must have a return type that is convertible to T . |
The following code snippet demonstrates how to use square
to square the elements of a device_vector of floats
.