Template Struct identity¶
Defined in File functional.h
Struct Documentation¶
-
template<typename
T
>
structidentity
¶ identity
is a Unary Function that represents the identity function: it takes a single argumentx
, and returnsx
.The following code snippet demonstrates that
identity
returns its argument.- Template Parameters
T
: No requirements onT
.
#include <thrust/functional.h> #include <assert.h> ... int x = 137; thrust::identity<int> id; assert(x == id(x));
Public Types
-
typedef
argument_type
¶ The type of the function object’s first argument.
-
typedef
result_type
¶ The type of the function object’s result;.
Public Functions
-
__host__ __device__ const T& thrust::identity::operator()(const T & x) const
Function call operator. The return value is
x
.