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

Commit

Permalink
Merge pull request #1514 from senior-zero/main-bug/github/default_con…
Browse files Browse the repository at this point in the history
…tructed_counting_iterator

Fix default constructor of counting iterator
  • Loading branch information
gevtushenko authored Sep 23, 2021
2 parents 9af3392 + 3c68488 commit e82f557
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 e82f557

Please sign in to comment.