thrust::logical_not
Defined in thrust/functional.h
-
template<typename T = void>
struct logical_not : public cuda::std::logical_not<void> logical_not
is a function object. Specifically, it is an Adaptable Predicate, which means it is a function object that tests the truth or falsehood of some condition. Iff
is an object of classlogical_not<T>
andx
is an object of classT
(whereT
is convertible tobool
) thenf(x)
returnstrue
if and only ifx
isfalse
.The following code snippet demonstrates how to use
logical_not
to transform a device_vector ofbools
into its logical complement.#include <thrust/device_vector.h> #include <thrust/transform.h> #include <thrust/functional.h> ... thrust::device_vector<bool> V; ... thrust::transform(V.begin(), V.end(), V.begin(), thrust::logical_not<bool>()); // The elements of V are now the logical complement of what they were prior
See also
- Template Parameters
T – must be convertible to
bool
.