1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2014 Roshan <thisisroshansmail@gmail.com>
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
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
11 #ifndef BOOST_COMPUTE_ALGORITHM_PARTITION_POINT_HPP
12 #define BOOST_COMPUTE_ALGORITHM_PARTITION_POINT_HPP
14 #include <boost/compute/system.hpp>
15 #include <boost/compute/command_queue.hpp>
16 #include <boost/compute/algorithm/detail/binary_find.hpp>
22 /// \brief Partition point algorithm
24 /// Finds the end of true values in the partitioned range [first, last)
25 /// \return Iterator pointing to end of true values
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
32 /// Space complexity: \Omega(1)
34 /// \see partition() and stable_partition()
36 template<class InputIterator, class UnaryPredicate>
37 inline InputIterator partition_point(InputIterator first,
39 UnaryPredicate predicate,
40 command_queue &queue = system::default_queue())
42 return detail::binary_find(first, last, not1(predicate), queue);
45 } // end compute namespace
46 } // end boost namespace
48 #endif // BOOST_COMPUTE_ALGORITHM_PARTITION_POINT_HPP