1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2014 Roshan <thisisroshansmail@gmail.com>
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
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
11 #ifndef BOOST_COMPUTE_ALGORITHM_ROTATE_COPY_HPP
12 #define BOOST_COMPUTE_ALGORITHM_ROTATE_COPY_HPP
14 #include <boost/compute/system.hpp>
15 #include <boost/compute/algorithm/copy.hpp>
20 /// Performs left rotation such that element at n_first comes to the
21 /// beginning and the output is stored in range starting at result.
24 template<class InputIterator, class OutputIterator>
25 inline void rotate_copy(InputIterator first,
26 InputIterator n_first,
28 OutputIterator result,
29 command_queue &queue = system::default_queue())
31 size_t count = detail::iterator_range_size(first, n_first);
32 size_t count2 = detail::iterator_range_size(n_first, last);
34 ::boost::compute::copy(first+count, last, result, queue);
35 ::boost::compute::copy(first, first+count, result+count2, queue);
38 } //end compute namespace
39 } //end boost namespace
41 #endif // BOOST_COMPUTE_ALGORITHM_ROTATE_COPY_HPP