]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/compute/include/boost/compute/algorithm/remove_if.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / compute / include / boost / compute / algorithm / remove_if.hpp
CommitLineData
7c673cae
FG
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_IF_HPP
12#define BOOST_COMPUTE_ALGORITHM_REMOVE_IF_HPP
13
14#include <boost/compute/system.hpp>
15#include <boost/compute/algorithm/copy_if.hpp>
16#include <boost/compute/container/vector.hpp>
17#include <boost/compute/functional/logical.hpp>
18
19namespace boost {
20namespace compute {
21
22/// Removes each element for which \p predicate returns \c true in the
23/// range [\p first, \p last).
24///
25/// \see remove()
26template<class Iterator, class Predicate>
27inline Iterator remove_if(Iterator first,
28 Iterator last,
29 Predicate predicate,
30 command_queue &queue = system::default_queue())
31{
32 typedef typename std::iterator_traits<Iterator>::value_type value_type;
33
34 // temporary storage for the input data
35 ::boost::compute::vector<value_type> tmp(first, last, queue);
36
37 return ::boost::compute::copy_if(tmp.begin(),
38 tmp.end(),
39 first,
40 not1(predicate),
41 queue);
42}
43
44} // end compute namespace
45} // end boost namespace
46
47#endif // BOOST_COMPUTE_ALGORITHM_REMOVE_IF_HPP