|
20 | 20 |
|
21 | 21 | #include <vector> |
22 | 22 | #include <list> |
| 23 | +#include <type_traits> // For add_const_t. |
23 | 24 | #include "itkConstShapedNeighborhoodIterator.h" |
24 | 25 |
|
25 | 26 | namespace itk |
@@ -219,10 +220,24 @@ class ITK_TEMPLATE_EXPORT ShapedNeighborhoodIterator |
219 | 220 |
|
220 | 221 | /** Constructor which establishes the region size, neighborhood, and image |
221 | 222 | * over which to walk. */ |
222 | | - ShapedNeighborhoodIterator(const SizeType & radius, const ImageType * ptr, const RegionType & region) |
223 | | - : Superclass(radius, const_cast<ImageType *>(ptr), region) |
| 223 | + ShapedNeighborhoodIterator(const SizeType & radius, ImageType * ptr, const RegionType & region) |
| 224 | + : Superclass(radius, ptr, region) |
224 | 225 | {} |
225 | 226 |
|
| 227 | +#ifndef ITK_FUTURE_LEGACY_REMOVE |
| 228 | + /** Constructor which establishes the region size, neighborhood, and image over which to walk. |
| 229 | + \deprecated This constructor is intended to be removed. For a `const` image, use ConstShapedNeighborhoodIterator |
| 230 | + instead! */ |
| 231 | + ITK_FUTURE_DEPRECATED( |
| 232 | + "This constructor is intended to be removed. For a `const` image, use ConstShapedNeighborhoodIterator instead!") |
| 233 | + ShapedNeighborhoodIterator(const SizeType & radius, std::add_const_t<ImageType> * ptr, const RegionType & region) |
| 234 | + : Superclass(radius, ptr, region) |
| 235 | + { |
| 236 | + // Note: parameter type `std::add_const_t<ImageType> *` prevents accidental class template argument deduction |
| 237 | + // (CTAD). |
| 238 | + } |
| 239 | +#endif |
| 240 | + |
226 | 241 | // Expose the following methods from the superclass. This is a restricted |
227 | 242 | // subset of the methods available for NeighborhoodIterator. |
228 | 243 | using Superclass::SetPixel; |
|
0 commit comments