Struct thrust::binary_function
binary_function
is an empty base class: it contains no member functions or member variables, but only type information. The only reason it exists is to make it more convenient to define types that are models of the concept Adaptable Binary Function. Specifically, any model of Adaptable Binary Function must define nested typedefs
. Those typedefs
are provided by the base class binary_function
.
The following code snippet demonstrates how to construct an Adaptable Binary Function using binary_function
.
struct exponentiate : public thrust::binary_function<float,float,float>
{
__host__ __device__
float operator()(float x, float y) { return powf(x,y); }
};
Note: Because C++11 language support makes the functionality of binary_function
obsolete, its use is optional if C++11 language features are enabled.
See:
#include <thrust/functional.h>
template <typename Argument1, typename Argument2, typename Result> struct thrust::binary_function { public:
/* The type of the function object's first argument. */ typedef see below first_argument_type;
/* The type of the function object's second argument. */ typedef see below second_argument_type;
/* The type of the function object's result;. */ typedef see below result_type; };
Member Types
Typedef thrust::binary_function::first_argument_type
typedef Argument1first_argument_type;
The type of the function object’s first argument.
Typedef thrust::binary_function::second_argument_type
typedef Argument2second_argument_type;
The type of the function object’s second argument.
Typedef thrust::binary_function::result_type
typedef Resultresult_type;
The type of the function object’s result;.