]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/compute/algorithm/partition_point.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / compute / algorithm / partition_point.hpp
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/static_assert.hpp>
15
16 #include <boost/compute/system.hpp>
17 #include <boost/compute/command_queue.hpp>
18 #include <boost/compute/algorithm/detail/binary_find.hpp>
19 #include <boost/compute/type_traits/is_device_iterator.hpp>
20
21 namespace boost {
22 namespace compute {
23
24 ///
25 /// \brief Partition point algorithm
26 ///
27 /// Finds the end of true values in the partitioned range [first, last)
28 /// \return Iterator pointing to end of true values
29 ///
30 /// \param first Iterator pointing to start of range
31 /// \param last Iterator pointing to end of range
32 /// \param predicate Unary predicate to be applied on each element
33 /// \param queue Queue on which to execute
34 ///
35 /// Space complexity: \Omega(1)
36 ///
37 /// \see partition() and stable_partition()
38 ///
39 template<class InputIterator, class UnaryPredicate>
40 inline InputIterator partition_point(InputIterator first,
41 InputIterator last,
42 UnaryPredicate predicate,
43 command_queue &queue = system::default_queue())
44 {
45 BOOST_STATIC_ASSERT(is_device_iterator<InputIterator>::value);
46 return detail::binary_find(first, last, not1(predicate), queue);
47 }
48
49 } // end compute namespace
50 } // end boost namespace
51
52 #endif // BOOST_COMPUTE_ALGORITHM_PARTITION_POINT_HPP