...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::compute::copy_n
// In header: <boost/compute/algorithm/copy_n.hpp> template<typename InputIterator, typename Size, typename OutputIterator> OutputIterator copy_n(InputIterator first, Size count, OutputIterator result, command_queue & queue = system::default_queue(), const wait_list & events = wait_list());
Copies count
elements from first
to result
.
For example, to copy four values from the host to the device:
// values on the host and vector on the device float values[4] = { 1.f, 2.f, 3.f, 4.f }; boost::compute::vector<float> vec(4, context); // copy from the host to the device boost::compute::copy_n(values, 4, vec.begin(), queue);
Space complexity: \Omega(1)
See Also:
copy()