partition.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //---------------------------------------------------------------------------//
  2. // Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@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. #ifndef BOOST_COMPUTE_ALGORITHM_PARTITION_HPP
  11. #define BOOST_COMPUTE_ALGORITHM_PARTITION_HPP
  12. #include <boost/compute/system.hpp>
  13. #include <boost/compute/command_queue.hpp>
  14. #include <boost/compute/algorithm/stable_partition.hpp>
  15. namespace boost {
  16. namespace compute {
  17. ///
  18. /// Partitions the elements in the range [\p first, \p last) according to
  19. /// \p predicate. Order of the elements need not be preserved.
  20. ///
  21. /// \see is_partitioned() and stable_partition()
  22. ///
  23. template<class Iterator, class UnaryPredicate>
  24. inline Iterator partition(Iterator first,
  25. Iterator last,
  26. UnaryPredicate predicate,
  27. command_queue &queue = system::default_queue())
  28. {
  29. return stable_partition(first, last, predicate, queue);
  30. }
  31. } // end compute namespace
  32. } // end boost namespace
  33. #endif // BOOST_COMPUTE_ALGORITHM_PARTITION_HPP