File indexing completed on 2025-01-18 09:29:57
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_COMPUTE_ALGORITHM_REMOVE_IF_HPP
0012 #define BOOST_COMPUTE_ALGORITHM_REMOVE_IF_HPP
0013
0014 #include <boost/static_assert.hpp>
0015
0016 #include <boost/compute/system.hpp>
0017 #include <boost/compute/algorithm/copy_if.hpp>
0018 #include <boost/compute/container/vector.hpp>
0019 #include <boost/compute/functional/logical.hpp>
0020 #include <boost/compute/type_traits/is_device_iterator.hpp>
0021
0022 namespace boost {
0023 namespace compute {
0024
0025
0026
0027
0028
0029
0030
0031 template<class Iterator, class Predicate>
0032 inline Iterator remove_if(Iterator first,
0033 Iterator last,
0034 Predicate predicate,
0035 command_queue &queue = system::default_queue())
0036 {
0037 BOOST_STATIC_ASSERT(is_device_iterator<Iterator>::value);
0038 typedef typename std::iterator_traits<Iterator>::value_type value_type;
0039
0040
0041 ::boost::compute::vector<value_type> tmp(first, last, queue);
0042
0043 return ::boost::compute::copy_if(tmp.begin(),
0044 tmp.end(),
0045 first,
0046 not1(predicate),
0047 queue);
0048 }
0049
0050 }
0051 }
0052
0053 #endif