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 <N.Dekker@lumc.nl>
  • Loading branch information
thewtex committed Apr 1, 2024
1 parent 5ce8cd1 commit 87caaac
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include/itkRLEImageScanlineConstIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,16 @@ 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
6 changes: 6 additions & 0 deletions include/itkRLEImageScanlineIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ 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 87caaac

Please sign in to comment.