Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:29:56

0001 //---------------------------------------------------------------------------//
0002 // Copyright (c) 2013-2014 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_FOR_EACH_N_HPP
0012 #define BOOST_COMPUTE_ALGORITHM_FOR_EACH_N_HPP
0013 
0014 #include <boost/static_assert.hpp>
0015 
0016 #include <boost/compute/algorithm/for_each.hpp>
0017 #include <boost/compute/type_traits/is_device_iterator.hpp>
0018 
0019 namespace boost {
0020 namespace compute {
0021 
0022 /// Calls \p function on each element in the range [\p first, \p first
0023 /// \c + \p count).
0024 ///
0025 /// Space complexity: \Omega(1)
0026 ///
0027 /// \see for_each()
0028 template<class InputIterator, class Size, class UnaryFunction>
0029 inline UnaryFunction for_each_n(InputIterator first,
0030                                 Size count,
0031                                 UnaryFunction function,
0032                                 command_queue &queue = system::default_queue())
0033 {
0034     BOOST_STATIC_ASSERT(is_device_iterator<InputIterator>::value);
0035     return ::boost::compute::for_each(first, first + count, function, queue);
0036 }
0037 
0038 } // end compute namespace
0039 } // end boost namespace
0040 
0041 #endif // BOOST_COMPUTE_ALGORITHM_FOR_EACH_N_HPP