ITK icon indicating copy to clipboard operation
ITK copied to clipboard

STYLE: Replace Fill calls with `auto var = itk::MakeFilled<T>` in tests

Open N-Dekker opened this issue 1 year ago • 2 comments

Replaced code of the form

T var;
var.Fill(x);

with auto var = itk::MakeFilled<T>(x);

Following C++ Core Guidelines, Oct 3, 2024, "Always initialize an object", https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-always

Using Notepad++, Replace in Files, doing:

Find what: ^( [ ]+)([^ ].*)[ ]+(\w+);[\r\n]+\1\3\.Fill\(
Replace with: $1auto $3 = itk::MakeFilled<$2>\(
Filters: itk*Test*.cxx
[v] Match case
(*) Regular expression

Follow-up to

  • pull request https://github.com/InsightSoftwareConsortium/ITK/pull/4881
  • pull request https://github.com/InsightSoftwareConsortium/ITK/pull/4884
  • pull request https://github.com/InsightSoftwareConsortium/ITK/pull/4887

N-Dekker avatar Oct 22 '24 14:10 N-Dekker