all_of
#
Overloads#
all_of(exec, first, last, pred)
#
-
template<typename DerivedPolicy, typename InputIterator, typename Predicate>
bool thrust::all_of( - const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
- InputIterator first,
- InputIterator last,
- Predicate pred,
all_of
determines whether all elements in a range satisfy a predicate. Specifically,all_of
returnstrue
ifpred(*i)
istrue
for every iteratori
in the range[first, last)
andfalse
otherwise.The algorithm’s execution is parallelized as determined by
exec
.#include <thrust/logical.h> #include <thrust/functional.h> #include <thrust/execution_policy.h> ... bool A[3] = {true, true, false}; thrust::all_of(thrust::host, A, A + 2, ::cuda::std::identity{}); // returns true thrust::all_of(thrust::host, A, A + 3, ::cuda::std::identity{}); // returns false // empty range thrust::all_of(thrust::host, A, A, ::cuda::std::identity{}); // returns true
See also
See also
See also
- Parameters:
exec – The execution policy to use for parallelization.
first – The beginning of the sequence.
last – The end of the sequence.
pred – A predicate used to test range elements.
- Template Parameters:
DerivedPolicy – The name of the derived execution policy.
InputIterator – is a model of Input Iterator,
Predicate – must be a model of Predicate.
- Returns:
true
, if all elements satisfy the predicate;false
, otherwise.
all_of(first, last, pred)
#
-
template<typename InputIterator, typename Predicate>
bool thrust::all_of( - InputIterator first,
- InputIterator last,
- Predicate pred,
all_of
determines whether all elements in a range satisfy a predicate. Specifically,all_of
returnstrue
ifpred(*i)
istrue
for every iteratori
in the range[first, last)
andfalse
otherwise.#include <thrust/logical.h> #include <thrust/functional.h> ... bool A[3] = {true, true, false}; thrust::all_of(A, A + 2, ::cuda::std::identity{}); // returns true thrust::all_of(A, A + 3, ::cuda::std::identity{}); // returns false // empty range thrust::all_of(A, A, ::cuda::std::identity{}); // returns true
See also
See also
See also
- Parameters:
first – The beginning of the sequence.
last – The end of the sequence.
pred – A predicate used to test range elements.
- Template Parameters:
InputIterator – is a model of Input Iterator,
Predicate – must be a model of Predicate.
- Returns:
true
, if all elements satisfy the predicate;false
, otherwise.