generate_n.hpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. //---------------------------------------------------------------------------//
  2. // Copyright (c) 2013 Kyle Lutz <[email protected]>
  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_GENERATE_N_HPP
  11. #define BOOST_COMPUTE_ALGORITHM_GENERATE_N_HPP
  12. #include <boost/compute/system.hpp>
  13. #include <boost/compute/command_queue.hpp>
  14. #include <boost/compute/algorithm/generate.hpp>
  15. namespace boost {
  16. namespace compute {
  17. /// Stores the result of \p generator for each element in the range
  18. /// [\p first, \p first + \p count).
  19. ///
  20. /// Space complexity: \Omega(1)
  21. template<class OutputIterator, class Size, class Generator>
  22. inline void generate_n(OutputIterator first,
  23. Size count,
  24. Generator generator,
  25. command_queue &queue = system::default_queue())
  26. {
  27. ::boost::compute::generate(first, first + count, generator, queue);
  28. }
  29. } // end compute namespace
  30. } // end boost namespace
  31. #endif // BOOST_COMPUTE_ALGORITHM_GENERATE_N_HPP