Skip to content

Commit 7f93459

Browse files
N-Dekkerdzenanz
authored andcommitted
ENH: Add C++17 CTAD deduction guides to ImageScanlineIterator
Added class template argument deduction guides to `ImageScanlineIterator` and `ImageScanlineConstIterator`, in order to support passing a `SmartPointer` as constructor argument.
1 parent 1b14a34 commit 7f93459

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

Modules/Core/Common/include/itkImageScanlineConstIterator.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,12 @@ class ITK_TEMPLATE_EXPORT ImageScanlineConstIterator : public ImageConstIterator
260260
OffsetValueType m_SpanBeginOffset{}; // one pixel the beginning of the scanline
261261
OffsetValueType m_SpanEndOffset{}; // one pixel past the end of the scanline
262262
};
263+
264+
// Deduction guide for class template argument deduction (CTAD).
265+
template <typename TImage>
266+
ImageScanlineConstIterator(SmartPointer<const TImage>, const typename TImage::RegionType &)
267+
->ImageScanlineConstIterator<TImage>;
268+
263269
} // end namespace itk
264270

265271
#ifndef ITK_MANUAL_INSTANTIATION

Modules/Core/Common/include/itkImageScanlineIterator.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ class ITK_TEMPLATE_EXPORT ImageScanlineIterator : public ImageScanlineConstItera
9696
Self &
9797
operator=(const ImageScanlineConstIterator<TImage> & it);
9898
};
99+
100+
// Deduction guide for class template argument deduction (CTAD).
101+
template <typename TImage>
102+
ImageScanlineIterator(SmartPointer<TImage>, const typename TImage::RegionType &)->ImageScanlineIterator<TImage>;
103+
99104
} // end namespace itk
100105

101106
#ifndef ITK_MANUAL_INSTANTIATION

0 commit comments

Comments
 (0)