Skip to content

Commit d833b22

Browse files
committed
Add is_device_asserts
1 parent ade726a commit d833b22

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

include/boost/compute/algorithm/fill.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#include <boost/compute/iterator/discard_iterator.hpp>
2929
#include <boost/compute/detail/is_buffer_iterator.hpp>
3030
#include <boost/compute/detail/iterator_range_size.hpp>
31+
#include <boost/compute/type_traits/is_device_iterator.hpp>
32+
3133

3234
namespace boost {
3335
namespace compute {
@@ -281,6 +283,7 @@ inline void fill(BufferIterator first,
281283
const T &value,
282284
command_queue &queue = system::default_queue())
283285
{
286+
BOOST_STATIC_ASSERT(is_device_iterator<BufferIterator>::value);
284287
size_t count = detail::iterator_range_size(first, last);
285288
if(count == 0){
286289
return;

include/boost/compute/algorithm/fill_n.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@
1111
#ifndef BOOST_COMPUTE_ALGORITHM_FILL_N_HPP
1212
#define BOOST_COMPUTE_ALGORITHM_FILL_N_HPP
1313

14+
#include <boost/static_assert.hpp>
15+
1416
#include <boost/compute/system.hpp>
1517
#include <boost/compute/command_queue.hpp>
1618
#include <boost/compute/algorithm/fill.hpp>
19+
#include <boost/compute/type_traits/is_device_iterator.hpp>
1720

1821
namespace boost {
1922
namespace compute {
@@ -29,6 +32,7 @@ inline void fill_n(BufferIterator first,
2932
const T &value,
3033
command_queue &queue = system::default_queue())
3134
{
35+
BOOST_STATIC_ASSERT(is_device_iterator<BufferIterator>::value);
3236
::boost::compute::fill(first, first + count, value, queue);
3337
}
3438

include/boost/compute/algorithm/iota.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@
1111
#ifndef BOOST_COMPUTE_ALGORITHM_IOTA_HPP
1212
#define BOOST_COMPUTE_ALGORITHM_IOTA_HPP
1313

14+
#include <boost/static_assert.hpp>
15+
1416
#include <boost/compute/system.hpp>
1517
#include <boost/compute/command_queue.hpp>
1618
#include <boost/compute/algorithm/copy.hpp>
1719
#include <boost/compute/iterator/counting_iterator.hpp>
20+
#include <boost/compute/type_traits/is_device_iterator.hpp>
1821

1922
namespace boost {
2023
namespace compute {
@@ -34,6 +37,7 @@ inline void iota(BufferIterator first,
3437
const T &value,
3538
command_queue &queue = system::default_queue())
3639
{
40+
BOOST_STATIC_ASSERT(is_device_iterator<BufferIterator>::value);
3741
T count = static_cast<T>(detail::iterator_range_size(first, last));
3842

3943
copy(

0 commit comments

Comments
 (0)