Skip to content

Commit e167dce

Browse files
committed
Refactor to avoid a static_cast in example code.
1 parent e4380f1 commit e167dce

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

examples/raw_reference_cast.cu

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,9 @@ int main(void)
8484
typedef Vector::iterator Iterator;
8585
typedef thrust::device_system_tag System;
8686

87-
size_t N = 5;
88-
8987
// allocate device memory
90-
Vector A(N);
91-
Vector B(N);
88+
Vector A(5);
89+
Vector B(5);
9290

9391
// initialize A and B
9492
thrust::sequence(A.begin(), A.end());
@@ -100,7 +98,7 @@ int main(void)
10098

10199
// note: we must specify the System to ensure correct execution
102100
thrust::for_each(thrust::counting_iterator<int,System>(0),
103-
thrust::counting_iterator<int,System>(static_cast<int>(N)),
101+
thrust::counting_iterator<int,System>(5),
104102
copy_iterators<Iterator,Iterator>(A.begin(), B.begin()));
105103

106104
std::cout << "After A->B Copy" << std::endl;

0 commit comments

Comments
 (0)