Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Fix default constructor of counting iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
gevtushenko committed Aug 26, 2021
1 parent ed84044 commit 3c68488
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions testing/counting_iterator.cu
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@

THRUST_DISABLE_MSVC_POSSIBLE_LOSS_OF_DATA_WARNING_BEGIN

template <typename T>
void TestCountingDefaultConstructor(void)
{
thrust::counting_iterator<T> iter0;
ASSERT_EQUAL(*iter0, T{});
}
DECLARE_GENERIC_UNITTEST(TestCountingDefaultConstructor);

void TestCountingIteratorCopyConstructor(void)
{
thrust::counting_iterator<int> iter0(100);
Expand Down
6 changes: 3 additions & 3 deletions thrust/iterator/counting_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ template<typename Incrementable,
/*! \endcond
*/

/*! Null constructor initializes this \p counting_iterator's \c Incrementable
* counter using its null constructor.
/*! Default constructor initializes this \p counting_iterator's counter to
* `Incrementable{}`.
*/
__host__ __device__
counting_iterator() {}
counting_iterator() : super_t(Incrementable{}) {}

/*! Copy constructor copies the value of another \p counting_iterator into a
* new \p counting_iterator.
Expand Down

0 comments on commit 3c68488

Please sign in to comment.