diff --git a/Modules/Core/Common/include/itkImageBufferRange.h b/Modules/Core/Common/include/itkImageBufferRange.h index 04171463848..28134ad4482 100644 --- a/Modules/Core/Common/include/itkImageBufferRange.h +++ b/Modules/Core/Common/include/itkImageBufferRange.h @@ -23,7 +23,7 @@ #include // For ptrdiff_t. #include // For random_access_iterator_tag. #include -#include // For conditional, is_same, and is_const. +#include // For conditional, enable_if, is_same, and is_const. #include "itkMacro.h" // For itkNotUsed. #include "itkDefaultPixelAccessor.h" @@ -300,17 +300,15 @@ class ImageBufferRange final * the guarantee added to the C++14 Standard: "value-initialized iterators * may be compared and shall compare equal to other value-initialized * iterators of the same type." - * \note `QualifiedIterator` follows the C++ "Rule of Zero" when - * VIsConst is true: The other five "special member functions" of the class - * are then implicitly defaulted. When VIsConst is false, its - * copy-constructor is provided explicitly, but it still behaves the same as - * a default implementation. + * + * \note The other five "special member functions" are defaulted implicitly, + * following the C++ "Rule of Zero". */ 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 & arg) noexcept + /** Constructor for implicit conversion from non-const to const iterator. */ + template > + QualifiedIterator(const QualifiedIterator & arg) noexcept : // Note: Use parentheses instead of curly braces to initialize data members, // to avoid AppleClang 6.0.0.6000056 compilation error, "no viable conversion..." m_OptionalAccessorFunctor(arg.m_OptionalAccessorFunctor) @@ -475,11 +473,6 @@ class ImageBufferRange 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; diff --git a/Modules/Core/Common/include/itkImageRegionRange.h b/Modules/Core/Common/include/itkImageRegionRange.h index ea769e244aa..e203267d3c7 100644 --- a/Modules/Core/Common/include/itkImageRegionRange.h +++ b/Modules/Core/Common/include/itkImageRegionRange.h @@ -25,7 +25,7 @@ #include // For bidirectional_iterator_tag. #include // For multiplies. #include // For accumulate. -#include // For conditional and is_const. +#include // For conditional, enable_if, and is_const. #include "itkImageHelper.h" #include "itkImageRegion.h" @@ -205,12 +205,15 @@ class ImageRegionRange final * the guarantee added to the C++14 Standard: "value-initialized iterators * may be compared and shall compare equal to other value-initialized * iterators of the same type." + * + * \note The other five "special member functions" are defaulted implicitly, + * following the C++ "Rule of Zero". */ 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 & arg) noexcept + /** Constructor for implicit conversion from non-const to const iterator. */ + template > + QualifiedIterator(const QualifiedIterator & arg) noexcept : m_BufferIterator(arg.m_BufferIterator) , // Note: Use parentheses instead of curly braces to initialize data members, @@ -281,15 +284,6 @@ class ImageRegionRange final // Implemented just like the corresponding std::rel_ops operator. return !(lhs == rhs); } - - - /** Explicitly-defaulted assignment operator. */ - QualifiedIterator & - operator=(const QualifiedIterator &) noexcept = default; - - - /** Explicitly-defaulted destructor. */ - ~QualifiedIterator() = default; }; // Inspired by, and originally copied from ImageBase::FastComputeOffset(ind)).