]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/compute/algorithm/remove.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / compute / algorithm / remove.hpp
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
3 //
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
7 //
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
10
11 #ifndef BOOST_COMPUTE_ALGORITHM_REMOVE_HPP
12 #define BOOST_COMPUTE_ALGORITHM_REMOVE_HPP
13
14 #include <boost/compute/lambda.hpp>
15 #include <boost/compute/system.hpp>
16 #include <boost/compute/algorithm/remove_if.hpp>
17 #include <boost/compute/type_traits/vector_size.hpp>
18
19 namespace boost {
20 namespace compute {
21
22 /// Removes each element equal to \p value in the range [\p first,
23 /// \p last).
24 ///
25 /// Space complexity: \Omega(3n)
26 ///
27 /// \see remove_if()
28 template<class Iterator, class T>
29 inline Iterator remove(Iterator first,
30 Iterator last,
31 const T &value,
32 command_queue &queue = system::default_queue())
33 {
34 typedef typename std::iterator_traits<Iterator>::value_type value_type;
35
36 using ::boost::compute::_1;
37 using ::boost::compute::lambda::all;
38
39 if(vector_size<value_type>::value == 1){
40 return ::boost::compute::remove_if(first,
41 last,
42 _1 == value,
43 queue);
44 }
45 else {
46 return ::boost::compute::remove_if(first,
47 last,
48 all(_1 == value),
49 queue);
50 }
51 }
52
53 } // end compute namespace
54 } // end boost namespace
55
56 #endif // BOOST_COMPUTE_ALGORITHM_REMOVE_HPP