| Home | Libraries | People | FAQ | More

## Function template copy_n

boost::compute::copy_n

## Synopsis

    // 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());

## Description

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()