Template Struct logical_not¶
Defined in File functional.h
Struct Documentation¶
-
template<typename
T>
structlogical_not¶ logical_notis 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. Iffis an object of classlogical_not<T>andxis an object of classT(whereTis convertible tobool) thenf(x)returnstrueif and only ifxisfalse.The following code snippet demonstrates how to use
logical_notto transform a device_vector ofboolsinto its logical complement.- Template Parameters
T: must be convertible tobool.
#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
Public Types
-
typedef
first_argument_type¶ The type of the function object’s first argument.
-
typedef
second_argument_type¶ The type of the function object’s second argument.
-
typedef
result_type¶ The type of the function object’s result;.
Public Functions
-
__host__ __device__ bool thrust::logical_not::operator()(const T & x) const Function call operator. The return value is
!x.