Function Object Adaptors
/* \exclude */namespace thrust::detail { … }
template <typename Argument, typename Result> struct thrust::unary_function;
template <typename Argument1, typename Argument2, typename Result> struct thrust::binary_function;
template <typename Predicate> struct thrust::unary_negate;
template <typename Predicate> struct thrust::binary_negate;
template <typename Function> class thrust::zip_function;
template <typename Predicate> __host__ __device__ unary_negate< Predicate > thrust::not1(const Predicate & pred);
template <typename BinaryPredicate> __host__ __device__ binary_negate< BinaryPredicate > thrust::not2(const BinaryPredicate & pred);
template <typename Function> __host__ __device__ zip_function< typename std::decay< Function >::type > thrust::make_zip_function(Function && fun);
Member Classes
Struct thrust::unary_function
Struct thrust::binary_function
Struct thrust::unary_negate
Inherits From: thrust::unary_function< Predicate::argument_type, bool >
Struct thrust::binary_negate
Inherits From: thrust::binary_function< Predicate::first_argument_type, Predicate::second_argument_type, bool >
Class thrust::zip_function
Functions
Function thrust::not1
template <typename Predicate> __host__ __device__ unary_negate< Predicate > not1(const Predicate & pred);
not1
is a helper function to simplify the creation of Adaptable Predicates: it takes an Adaptable Predicate pred
as an argument and returns a new Adaptable Predicate that represents the negation of pred
. That is: if pred
is an object of a type which models Adaptable Predicate, then the the type of the result npred
of not1(pred)
is also a model of Adaptable Predicate and npred(x)
always returns the same value as !pred(x)
.
Template Parameters: Predicate
: is a model of Adaptable Predicate.
Function Parameters: pred
: The Adaptable Predicate to negate.
Returns: A new object, npred
such that npred(x)
always returns the same value as !pred(x)
.
See:
- unary_negate
- not2
Function thrust::not2
template <typename BinaryPredicate> __host__ __device__ binary_negate< BinaryPredicate > not2(const BinaryPredicate & pred);
not2
is a helper function to simplify the creation of Adaptable Binary Predicates: it takes an Adaptable Binary Predicate pred
as an argument and returns a new Adaptable Binary Predicate that represents the negation of pred
. That is: if pred
is an object of a type which models Adaptable Binary Predicate, then the the type of the result npred
of not2(pred)
is also a model of Adaptable Binary Predicate and npred(x,y)
always returns the same value as !pred(x,y)
.
Template Parameters: Binary
: Predicate is a model of Adaptable Binary Predicate.
Function Parameters: pred
: The Adaptable Binary Predicate to negate.
Returns: A new object, npred
such that npred(x,y)
always returns the same value as !pred(x,y)
.
See:
- binary_negate
- not1
Function thrust::make_zip_function
template <typename Function> __host__ __device__ zip_function< typename std::decay< Function >::type > make_zip_function(Function && fun);
make_zip_function
creates a zip_function
from a function object.
Function Parameters: fun
: The N-ary function object.
Returns: A zip_function
that takes a N-tuple.
See: zip_function