thrust::any_of
Defined in thrust/logical.h
- 
template<typename DerivedPolicy, typename InputIterator, typename Predicate>
 bool thrust::any_of(const thrust::detail::execution_policy_base<DerivedPolicy> &exec, InputIterator first, InputIterator last, Predicate pred)
- any_ofdetermines whether any element in a range satisfies a predicate. Specifically,- any_ofreturns- trueif- pred(*i)is- truefor any iterator- iin the range- [first, last)and- falseotherwise.- 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::any_of(thrust::host, A, A + 2, ::cuda::std::identity{}); // returns true thrust::any_of(thrust::host, A, A + 3, ::cuda::std::identity{}); // returns true thrust::any_of(thrust::host, A + 2, A + 3, ::cuda::std::identity{}); // returns false // empty range thrust::any_of(thrust::host, A, A, ::cuda::std::identity{}); // returns false - See also - all_of - See also - none_of - See also - transform_reduce - 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 any element satisfies the predicate;- false, otherwise.