• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
3 //
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
7 //
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
10 
11 #ifndef BOOST_COMPUTE_ALGORITHM_FILL_N_HPP
12 #define BOOST_COMPUTE_ALGORITHM_FILL_N_HPP
13 
14 #include <boost/static_assert.hpp>
15 
16 #include <boost/compute/system.hpp>
17 #include <boost/compute/command_queue.hpp>
18 #include <boost/compute/algorithm/fill.hpp>
19 #include <boost/compute/type_traits/is_device_iterator.hpp>
20 
21 namespace boost {
22 namespace compute {
23 
24 /// Fills the range [\p first, \p first + count) with \p value.
25 ///
26 /// Space complexity: \Omega(1)
27 ///
28 /// \see fill()
29 template<class BufferIterator, class Size, class T>
fill_n(BufferIterator first,Size count,const T & value,command_queue & queue=system::default_queue ())30 inline void fill_n(BufferIterator first,
31                    Size count,
32                    const T &value,
33                    command_queue &queue = system::default_queue())
34 {
35     BOOST_STATIC_ASSERT(is_device_iterator<BufferIterator>::value);
36     ::boost::compute::fill(first, first + count, value, queue);
37 }
38 
39 } // end compute namespace
40 } // end boost namespace
41 
42 #endif // BOOST_COMPUTE_ALGORITHM_FILL_N_HPP
43