Skip to content

Commit 1dfd76b

Browse files
committed
STYLE: Move iterator declaration to for ContourExtractor2DImageFilter
Reduced the scope of the local `inputIt` variable in `GenerateDataForLabels()`, by moving its declaration into the _init-statement_ of its `for` loop. Following C++ Core Guidelines, Jul 8, 2025 "Declare names in for-statement initializers and conditions to limit scope", https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#res-cond Removed the `inputIt.GoToBegin()` call, following pull request #5736 commit f10bd8f "STYLE: Remove GoToBegin() calls on ImageRegionIteratorWithIndex"
1 parent 4be530e commit 1dfd76b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Modules/Filtering/Path/include/itkContourExtractor2DImageFilter.hxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,7 @@ ContourExtractor2DImageFilter<TInputImage>::GenerateDataForLabels()
350350
}
351351
// We use ImageRegionConstIteratorWithIndex here instead of RegionRange because we want access to the GetIndex()
352352
// method.
353-
ImageRegionConstIteratorWithIndex<TInputImage> inputIt{ input, inputRegion };
354-
for (inputIt.GoToBegin(); !inputIt.IsAtEnd(); ++inputIt)
353+
for (ImageRegionConstIteratorWithIndex<TInputImage> inputIt{ input, inputRegion }; !inputIt.IsAtEnd(); ++inputIt)
355354
{
356355
const auto & index = inputIt.GetIndex();
357356
BoundingBoxType & bbox = labelBoundingBoxes[inputIt.Get()];

0 commit comments

Comments
 (0)