Skip to content

Commit

Permalink
COMP: Add compiler deduction guides RLEImage ImageScanlineConstIterator
Browse files Browse the repository at this point in the history
This addresses
InsightSoftwareConsortium/ITK#4537

In addition to SmartPointer arguments, we need a raw const pointer
version.

Suggested-by: Niels Dekker <[email protected]>
  • Loading branch information
thewtex committed Apr 1, 2024
1 parent 5ce8cd1 commit 997f85f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
12 changes: 12 additions & 0 deletions include/itkRLEImageScanlineConstIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,18 @@ class ImageScanlineConstIterator<RLEImage<TPixel, VImageDimension, CounterType>>
return *this;
}
};

// Deduction guide for class template argument deduction (CTAD).
template <typename TPixel, unsigned int VImageDimension, typename CounterType>
ImageScanlineConstIterator(SmartPointer<const RLEImage<TPixel, VImageDimension, CounterType>>,
const typename RLEImage<TPixel, VImageDimension, CounterType>::RegionType &)
->ImageScanlineConstIterator<RLEImage<TPixel, VImageDimension, CounterType>>;

template <typename TPixel, unsigned int VImageDimension, typename CounterType>
ImageScanlineConstIterator(const RLEImage<TPixel, VImageDimension, CounterType> *,
const typename RLEImage<TPixel, VImageDimension, CounterType>::RegionType &)
->ImageScanlineConstIterator<RLEImage<TPixel, VImageDimension, CounterType>>;

} // end namespace itk

#endif // itkRLEImageScanlineConstIterator_h
7 changes: 7 additions & 0 deletions include/itkRLEImageScanlineIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ class ImageScanlineIterator<RLEImage<TPixel, VImageDimension, CounterType>>
return *this;
}
};

// Deduction guide for class template argument deduction (CTAD).
template <typename TPixel, unsigned int VImageDimension, typename CounterType>
ImageScanlineIterator(SmartPointer<RLEImage<TPixel, VImageDimension, CounterType>>,
const typename RLEImage<TPixel, VImageDimension, CounterType>::RegionType &)
->ImageScanlineIterator<RLEImage<TPixel, VImageDimension, CounterType>>;

} // end namespace itk

#endif // itkRLEImageScanlineIterator_h

0 comments on commit 997f85f

Please sign in to comment.