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 74b4ddb commit edb4310
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions include/itkRLEImageScanlineConstIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,14 @@ 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
5 changes: 5 additions & 0 deletions include/itkRLEImageScanlineIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ 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 edb4310

Please sign in to comment.