Skip to content

Commit

Permalink
COMP: QualifiedIterator follow rule of zero
Browse files Browse the repository at this point in the history
Use implicit copy constuctor by implementing SFINAE for non-const to
const conversion.

Addresses complation warning with clang-1316.0.21.2.5:

definition of implicit copy constructor for 'QualifiedIterator<true>'
is deprecated because it has a user-declared copy assignment operator
  • Loading branch information
blowekamp committed May 18, 2023
1 parent 56c7434 commit df6aa66
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions Modules/Core/Common/include/itkShapedImageNeighborhoodRange.h
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,9 @@ class ShapedImageNeighborhoodRange final
*/
QualifiedIterator() = default;

/** Constructor that allows implicit conversion from non-const to const
* iterator. Also serves as copy-constructor of a non-const iterator. */
QualifiedIterator(const QualifiedIterator<false> & arg) noexcept
/** Constructor for implicit conversion from non-const to const iterator. */
template <bool VIsArgumentConst, typename = std::enable_if_t<VIsConst && !VIsArgumentConst>>
QualifiedIterator(const QualifiedIterator<VIsArgumentConst> & arg) noexcept
: m_ImageBufferPointer{ arg.m_ImageBufferPointer }
,
// Note: Use parentheses instead of curly braces to initialize data members,
Expand Down Expand Up @@ -569,11 +569,6 @@ class ShapedImageNeighborhoodRange final

/** Returns it[n] for iterator 'it' and integer value 'n'. */
reference operator[](const difference_type n) const noexcept { return *(*this + n); }


/** Explicitly-defaulted assignment operator. */
QualifiedIterator &
operator=(const QualifiedIterator &) noexcept = default;
};

static constexpr bool IsImageTypeConst = std::is_const_v<TImage>;
Expand Down

0 comments on commit df6aa66

Please sign in to comment.