Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //---------------------------------------------------------------------------//
0002 // Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@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_HPP
0012 #define BOOST_COMPUTE_ALGORITHM_PARTITION_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/stable_partition.hpp>
0019 #include <boost/compute/type_traits/is_device_iterator.hpp>
0020 
0021 namespace boost {
0022 namespace compute {
0023 
0024 ///
0025 /// Partitions the elements in the range [\p first, \p last) according to
0026 /// \p predicate. Order of the elements need not be preserved.
0027 ///
0028 /// Space complexity: \Omega(3n)
0029 ///
0030 /// \see is_partitioned() and stable_partition()
0031 ///
0032 template<class Iterator, class UnaryPredicate>
0033 inline Iterator partition(Iterator first,
0034                           Iterator last,
0035                           UnaryPredicate predicate,
0036                           command_queue &queue = system::default_queue())
0037 {
0038     BOOST_STATIC_ASSERT(is_device_iterator<Iterator>::value);
0039     return stable_partition(first, last, predicate, queue);
0040 }
0041 
0042 } // end compute namespace
0043 } // end boost namespace
0044 
0045 #endif // BOOST_COMPUTE_ALGORITHM_PARTITION_HPP