]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | //---------------------------------------------------------------------------// |
2 | // Copyright (c) 2014 Roshan <thisisroshansmail@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_PARTITION_POINT_HPP | |
12 | #define BOOST_COMPUTE_ALGORITHM_PARTITION_POINT_HPP | |
13 | ||
14 | #include <boost/compute/system.hpp> | |
15 | #include <boost/compute/command_queue.hpp> | |
16 | #include <boost/compute/algorithm/detail/binary_find.hpp> | |
17 | ||
18 | namespace boost { | |
19 | namespace compute { | |
20 | ||
21 | /// | |
22 | /// \brief Partition point algorithm | |
23 | /// | |
24 | /// Finds the end of true values in the partitioned range [first, last) | |
25 | /// \return Iterator pointing to end of true values | |
26 | /// | |
27 | /// \param first Iterator pointing to start of range | |
28 | /// \param last Iterator pointing to end of range | |
29 | /// \param predicate Unary predicate to be applied on each element | |
30 | /// \param queue Queue on which to execute | |
31 | /// | |
32 | /// \see partition() and stable_partition() | |
33 | /// | |
34 | template<class InputIterator, class UnaryPredicate> | |
35 | inline InputIterator partition_point(InputIterator first, | |
36 | InputIterator last, | |
37 | UnaryPredicate predicate, | |
38 | command_queue &queue = system::default_queue()) | |
39 | { | |
40 | return detail::binary_find(first, last, not1(predicate), queue); | |
41 | } | |
42 | ||
43 | } // end compute namespace | |
44 | } // end boost namespace | |
45 | ||
46 | #endif // BOOST_COMPUTE_ALGORITHM_PARTITION_POINT_HPP |