thrust::unary_negate

Defined in thrust/functional.h

template<typename Predicate>
struct unary_negate

unary_negate is a function object adaptor: it is an Adaptable Predicate that represents the logical negation of some other Adaptable Predicate. That is: if f is an object of class unary_negate<AdaptablePredicate>, then there exists an object pred of class AdaptablePredicate such that f(x) always returns the same value as !pred(x). There is rarely any reason to construct a unary_negate directly; it is almost always easier to use the helper function not1.

deprecated [Since 2.6]

See also

not1

Public Types

using argument_type = typename Predicate::argument_type
using result_type = bool

Public Functions

inline explicit unary_negate(Predicate p)

Constructor takes a Predicate object to negate.

Parameters

p – The Predicate object to negate.

inline bool operator()(const typename Predicate::argument_type &x)

Function call operator. The return value is !pred(x).