| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
|
|
| |
| |
| |
|
|
| #pragma once |
|
|
| #include <thrust/detail/config.h> |
|
|
| #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) |
| # pragma GCC system_header |
| #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) |
| # pragma clang system_header |
| #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) |
| # pragma system_header |
| #endif |
| #include <thrust/pair.h> |
| #include <thrust/detail/function.h> |
| #include <thrust/system/detail/sequential/execution_policy.h> |
|
|
| THRUST_NAMESPACE_BEGIN |
| namespace system |
| { |
| namespace detail |
| { |
| namespace sequential |
| { |
|
|
|
|
| __thrust_exec_check_disable__ |
| template<typename DerivedPolicy, |
| typename ForwardIterator, |
| typename BinaryPredicate> |
| __host__ __device__ |
| ForwardIterator min_element(sequential::execution_policy<DerivedPolicy> &, |
| ForwardIterator first, |
| ForwardIterator last, |
| BinaryPredicate comp) |
| { |
| |
| thrust::detail::wrapped_function< |
| BinaryPredicate, |
| bool |
| > wrapped_comp(comp); |
|
|
| ForwardIterator imin = first; |
|
|
| for(; first != last; ++first) |
| { |
| if(wrapped_comp(*first, *imin)) |
| { |
| imin = first; |
| } |
| } |
|
|
| return imin; |
| } |
|
|
|
|
| __thrust_exec_check_disable__ |
| template<typename DerivedPolicy, |
| typename ForwardIterator, |
| typename BinaryPredicate> |
| __host__ __device__ |
| ForwardIterator max_element(sequential::execution_policy<DerivedPolicy> &, |
| ForwardIterator first, |
| ForwardIterator last, |
| BinaryPredicate comp) |
| { |
| |
| thrust::detail::wrapped_function< |
| BinaryPredicate, |
| bool |
| > wrapped_comp(comp); |
|
|
| ForwardIterator imax = first; |
|
|
| for(; first != last; ++first) |
| { |
| if(wrapped_comp(*imax, *first)) |
| { |
| imax = first; |
| } |
| } |
|
|
| return imax; |
| } |
|
|
|
|
| __thrust_exec_check_disable__ |
| template<typename DerivedPolicy, |
| typename ForwardIterator, |
| typename BinaryPredicate> |
| __host__ __device__ |
| thrust::pair<ForwardIterator,ForwardIterator> minmax_element(sequential::execution_policy<DerivedPolicy> &, |
| ForwardIterator first, |
| ForwardIterator last, |
| BinaryPredicate comp) |
| { |
| |
| thrust::detail::wrapped_function< |
| BinaryPredicate, |
| bool |
| > wrapped_comp(comp); |
|
|
| ForwardIterator imin = first; |
| ForwardIterator imax = first; |
|
|
| for(; first != last; ++first) |
| { |
| if(wrapped_comp(*first, *imin)) |
| { |
| imin = first; |
| } |
|
|
| if(wrapped_comp(*imax, *first)) |
| { |
| imax = first; |
| } |
| } |
|
|
| return thrust::make_pair(imin, imax); |
| } |
|
|
|
|
| } |
| } |
| } |
| THRUST_NAMESPACE_END |
|
|
|
|