diff --git a/thrust/system/cuda/detail/find.h b/thrust/system/cuda/detail/find.h index f6a1e59d1..298be0d1a 100644 --- a/thrust/system/cuda/detail/find.h +++ b/thrust/system/cuda/detail/find.h @@ -205,12 +205,10 @@ find(execution_policy &policy, InputIt last, T const& value) { - using thrust::placeholders::_1; - return cuda_cub::find_if(policy, first, last, - _1 == value); + thrust::detail::equal_to_value(value)); } diff --git a/thrust/system/cuda/detail/remove.h b/thrust/system/cuda/detail/remove.h index 700c95f23..c590a1adf 100644 --- a/thrust/system/cuda/detail/remove.h +++ b/thrust/system/cuda/detail/remove.h @@ -74,9 +74,8 @@ remove(execution_policy &policy, InputIt last, const T & value) { - using thrust::placeholders::_1; - - return cuda_cub::remove_if(policy, first, last, _1 == value); + thrust::detail::equal_to_value pred(value); + return cuda_cub::remove_if(policy, first, last, pred); } // copy diff --git a/thrust/system/cuda/detail/replace.h b/thrust/system/cuda/detail/replace.h index 3bd685108..d2ccb7b24 100644 --- a/thrust/system/cuda/detail/replace.h +++ b/thrust/system/cuda/detail/replace.h @@ -90,14 +90,12 @@ replace(execution_policy &policy, T const & old_value, T const & new_value) { - using thrust::placeholders::_1; - cuda_cub::transform_if(policy, first, last, first, __replace::constant_f(new_value), - _1 == old_value); + thrust::detail::equal_to_value(old_value)); } template &exec, InputIterator last, const T& value) { - using thrust::placeholders::_1; - - return thrust::find_if(exec, first, last, _1 == value); + // XXX consider a placeholder expression here + return thrust::find_if(exec, first, last, thrust::detail::equal_to_value(value)); } // end find() diff --git a/thrust/system/detail/generic/mismatch.inl b/thrust/system/detail/generic/mismatch.inl index 8348374a5..d879a6e11 100644 --- a/thrust/system/detail/generic/mismatch.inl +++ b/thrust/system/detail/generic/mismatch.inl @@ -38,9 +38,10 @@ __host__ __device__ InputIterator1 last1, InputIterator2 first2) { - using namespace thrust::placeholders; - - return thrust::mismatch(exec, first1, last1, first2, _1 == _2); + typedef typename thrust::iterator_value::type InputType1; + + // XXX use a placeholder expression here + return thrust::mismatch(exec, first1, last1, first2, thrust::detail::equal_to()); } // end mismatch() diff --git a/thrust/system/detail/generic/replace.inl b/thrust/system/detail/generic/replace.inl index eea70ccd1..d5b6caa63 100644 --- a/thrust/system/detail/generic/replace.inl +++ b/thrust/system/detail/generic/replace.inl @@ -15,10 +15,10 @@ */ #include -#include #include #include #include +#include namespace thrust { @@ -124,9 +124,8 @@ __host__ __device__ const T &old_value, const T &new_value) { - using thrust::placeholders::_1; - - return thrust::replace_copy_if(exec, first, last, result, _1 == old_value, new_value); + thrust::detail::equal_to_value pred(old_value); + return thrust::replace_copy_if(exec, first, last, result, pred, new_value); } // end replace_copy() @@ -165,9 +164,8 @@ __host__ __device__ const T &old_value, const T &new_value) { - using thrust::placeholders::_1; - - return thrust::replace_if(exec, first, last, _1 == old_value, new_value); + thrust::detail::equal_to_value pred(old_value); + return thrust::replace_if(exec, first, last, pred, new_value); } // end replace() diff --git a/thrust/system/detail/generic/sequence.inl b/thrust/system/detail/generic/sequence.inl index 16631c7f4..507f8b01d 100644 --- a/thrust/system/detail/generic/sequence.inl +++ b/thrust/system/detail/generic/sequence.inl @@ -15,7 +15,6 @@ */ #include -#include #include #include #include @@ -28,6 +27,30 @@ namespace detail { namespace generic { +namespace sequence_detail +{ + + +template +struct sequence_functor +{ + T init, step; + + __host__ __device__ + sequence_functor(T init, T step) + : init(init), step(step) + {} + + template + __host__ __device__ + T operator()(Index i) const + { + return static_cast(init + step * i); + } +}; + + +} // end sequence_detail template @@ -61,9 +84,8 @@ __host__ __device__ T init, T step) { - using thrust::placeholders::_1; - - thrust::tabulate(exec, first, last, init + step * _1); + // XXX TODO use a placeholder expression here + thrust::tabulate(exec, first, last, sequence_detail::sequence_functor(init, step)); } // end sequence()