thrust::remove_copy
Defined in thrust/remove.h
- 
template<typename DerivedPolicy, typename InputIterator, typename OutputIterator, typename T>
 OutputIterator thrust::remove_copy(const thrust::detail::execution_policy_base<DerivedPolicy> &exec, InputIterator first, InputIterator last, OutputIterator result, const T &value)
- remove_copycopies elements that are not equal to- valuefrom the range- [first, last)to a range beginning at- result. The return value is the end of the resulting range. This operation is stable, meaning that the relative order of the elements that are copied is the same as in the range- [first, last).- The algorithm’s execution is parallelized as determined by - exec.- The following code snippet demonstrates how to use - remove_copyto copy a sequence of numbers to an output range while omitting a value of interest using the- thrust::hostexecution policy for parallelization:- #include <thrust/remove.h> #include <thrust/execution_policy.h> ... const int N = 6; int V[N] = {-2, 0, -1, 0, 1, 2}; int result[N-2]; thrust::remove_copy(thrust::host, V, V + N, result, 0); // V remains {-2, 0, -1, 0, 1, 2} // result is now {-2, -1, 1, 2} - See also - remove - See also - remove_if - See also - remove_copy_if - Parameters
- exec – The execution policy to use for parallelization. 
- first – The beginning of the range of interest. 
- last – The end of the range of interest. 
- result – The resulting range is copied to the sequence beginning at this location. 
- value – The value to omit from the copied range. 
 
- Template Parameters
- DerivedPolicy – The name of the derived execution policy. 
- InputIterator – is a model of Input Iterator, and - InputIterator's- value_typeis convertible to a type in- OutputIterator'sset of- value_types.
- OutputIterator – is a model of Output Iterator. 
- T – is a model of Equality Comparable, and objects of type - Tcan be compared for equality with objects of- InputIterator's- value_type.
 
- Returns
- An OutputIterator pointing to the end of the resulting range of elements which are not equal to - value.
- Pre
- The range - [first, last)shall not overlap the range- [result, result + (last - first)).