Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:29:57

0001 //---------------------------------------------------------------------------//
0002 // Copyright (c) 2014 Roshan <thisisroshansmail@gmail.com>
0003 //
0004 // Distributed under the Boost Software License, Version 1.0
0005 // See accompanying file LICENSE_1_0.txt or copy at
0006 // http://www.boost.org/LICENSE_1_0.txt
0007 //
0008 // See http://boostorg.github.com/compute for more information.
0009 //---------------------------------------------------------------------------//
0010 
0011 #ifndef BOOST_COMPUTE_ALGORITHM_PARTITION_POINT_HPP
0012 #define BOOST_COMPUTE_ALGORITHM_PARTITION_POINT_HPP
0013 
0014 #include <boost/static_assert.hpp>
0015 
0016 #include <boost/compute/system.hpp>
0017 #include <boost/compute/command_queue.hpp>
0018 #include <boost/compute/algorithm/detail/binary_find.hpp>
0019 #include <boost/compute/type_traits/is_device_iterator.hpp>
0020 
0021 namespace boost {
0022 namespace compute {
0023 
0024 ///
0025 /// \brief Partition point algorithm
0026 ///
0027 /// Finds the end of true values in the partitioned range [first, last)
0028 /// \return Iterator pointing to end of true values
0029 ///
0030 /// \param first Iterator pointing to start of range
0031 /// \param last Iterator pointing to end of range
0032 /// \param predicate Unary predicate to be applied on each element
0033 /// \param queue Queue on which to execute
0034 ///
0035 /// Space complexity: \Omega(1)
0036 ///
0037 /// \see partition() and stable_partition()
0038 ///
0039 template<class InputIterator, class UnaryPredicate>
0040 inline InputIterator partition_point(InputIterator first,
0041                                      InputIterator last,
0042                                      UnaryPredicate predicate,
0043                                      command_queue &queue = system::default_queue())
0044 {
0045     BOOST_STATIC_ASSERT(is_device_iterator<InputIterator>::value);
0046     return detail::binary_find(first, last, not1(predicate), queue);
0047 }
0048 
0049 } // end compute namespace
0050 } // end boost namespace
0051 
0052 #endif // BOOST_COMPUTE_ALGORITHM_PARTITION_POINT_HPP