|
||||
File indexing completed on 2025-01-30 09:34:36
0001 //---------------------------------------------------------------------------// 0002 // Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com> 0003 // 0004 // Distributed under the Boost Software License, Version 1.0 0005 // See accompanying file LICENSE_1_0.txt or copy at 0006 // http://www.boost.org/LICENSE_1_0.txt 0007 // 0008 // See http://boostorg.github.com/compute for more information. 0009 //---------------------------------------------------------------------------// 0010 0011 #ifndef BOOST_COMPUTE_ALGORITHM_COPY_N_HPP 0012 #define BOOST_COMPUTE_ALGORITHM_COPY_N_HPP 0013 0014 #include <boost/compute/system.hpp> 0015 #include <boost/compute/command_queue.hpp> 0016 #include <boost/compute/algorithm/copy.hpp> 0017 0018 namespace boost { 0019 namespace compute { 0020 0021 /// Copies \p count elements from \p first to \p result. 0022 /// 0023 /// For example, to copy four values from the host to the device: 0024 /// \code 0025 /// // values on the host and vector on the device 0026 /// float values[4] = { 1.f, 2.f, 3.f, 4.f }; 0027 /// boost::compute::vector<float> vec(4, context); 0028 /// 0029 /// // copy from the host to the device 0030 /// boost::compute::copy_n(values, 4, vec.begin(), queue); 0031 /// \endcode 0032 /// 0033 /// Space complexity: \Omega(1) 0034 /// 0035 /// \see copy() 0036 template<class InputIterator, class Size, class OutputIterator> 0037 inline OutputIterator copy_n(InputIterator first, 0038 Size count, 0039 OutputIterator result, 0040 command_queue &queue = system::default_queue(), 0041 const wait_list &events = wait_list()) 0042 { 0043 typedef typename std::iterator_traits<InputIterator>::difference_type difference_type; 0044 0045 return ::boost::compute::copy(first, 0046 first + static_cast<difference_type>(count), 0047 result, 0048 queue, 0049 events); 0050 } 0051 0052 } // end compute namespace 0053 } // end boost namespace 0054 0055 #endif // BOOST_COMPUTE_ALGORITHM_COPY_N_HPP
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |