Skip to content

Commit 72c478b

Browse files
committed
Fix distributed::copy(), use std::iterator_traits<>
1 parent 09a56c9 commit 72c478b

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

include/boost/compute/distributed/copy.hpp

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ copy_async(InputIterator first,
5656
!is_device_iterator<InputIterator>::value
5757
>::type* = 0)
5858
{
59-
typedef typename InputIterator::difference_type diff_type;
59+
typedef typename
60+
std::iterator_traits<InputIterator>::difference_type diff_type;
61+
6062
std::vector<event> events;
6163
events.reserve(result.parts());
6264

@@ -128,7 +130,9 @@ copy_async(const vector<T, weight, Alloc> &input,
128130
>
129131
>::type* = 0)
130132
{
131-
typedef typename OutputIterator::difference_type diff_type;
133+
typedef typename
134+
std::iterator_traits<OutputIterator>::difference_type diff_type;
135+
132136
std::vector<event> events;
133137
events.reserve(input.parts());
134138

@@ -197,7 +201,9 @@ copy_async(InputIterator first,
197201
is_device_iterator<InputIterator>::value
198202
>::type* = 0)
199203
{
200-
typedef typename InputIterator::difference_type diff_type;
204+
typedef typename
205+
std::iterator_traits<InputIterator>::difference_type diff_type;
206+
201207
std::vector<event> events;
202208
events.reserve(result.parts());
203209

@@ -246,7 +252,9 @@ copy(InputIterator first,
246252
is_device_iterator<InputIterator>::value
247253
>::type* = 0)
248254
{
249-
typedef typename InputIterator::difference_type diff_type;
255+
typedef typename
256+
std::iterator_traits<InputIterator>::difference_type diff_type;
257+
250258
std::vector<event> events;
251259
events.reserve(result.parts());
252260

@@ -314,7 +322,9 @@ copy_async(const vector<T, weight, Alloc> &input,
314322
>
315323
>::type* = 0)
316324
{
317-
typedef typename OutputIterator::difference_type diff_type;
325+
typedef typename
326+
std::iterator_traits<OutputIterator>::difference_type diff_type;
327+
318328
std::vector<event> events;
319329
events.reserve(input.parts());
320330

@@ -362,7 +372,9 @@ copy(const vector<T, weight, Alloc> &input,
362372
>
363373
>::type* = 0)
364374
{
365-
typedef typename OutputIterator::difference_type diff_type;
375+
typedef typename
376+
std::iterator_traits<OutputIterator>::difference_type diff_type;
377+
366378
std::vector<event> events;
367379
events.reserve(input.parts());
368380

test/test_distributed_copy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// See http://boostorg.github.com/compute for more information.
99
//---------------------------------------------------------------------------//
1010

11-
#define BOOST_TEST_MODULE TestDistributedVector
11+
#define BOOST_TEST_MODULE TestDistributedCopy
1212
#include <boost/test/unit_test.hpp>
1313

1414
#include <boost/compute/algorithm.hpp>

0 commit comments

Comments
 (0)