-
-
Notifications
You must be signed in to change notification settings - Fork 671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
STYLE: Replace Fill calls with auto var = itk::MakeFilled<T>
in tests
#4891
STYLE: Replace Fill calls with auto var = itk::MakeFilled<T>
in tests
#4891
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good on a glance.
Honestly I find the syntax As a follow-up, the variable might in some cases be declared constexpr: // Assuming that the fill value x is also a compile-time constant:
constexpr auto var = itk::MakeFilled<T>(x); 😃 |
Hmmm, compilers don't like Let's postpone this pull request until after the following two have been processed: |
a9efd63
to
7750331
Compare
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 InsightSoftwareConsortium#4881 - pull request InsightSoftwareConsortium#4884 - pull request InsightSoftwareConsortium#4887
7750331
to
d6c9eed
Compare
Replaced code of the form T var; var.Fill(x); with `auto var = itk::MakeFilled<T>(x);` - Follow-up to pull request InsightSoftwareConsortium#4891 "STYLE: Replace Fill calls with `auto var = itk::MakeFilled<T>` in tests"
4b7886a
into
InsightSoftwareConsortium:master
Using Notepad++, Replace in Files, doing: Find what: ^( [ ]+)([^ ].*)[ ]+(\w+);[\r\n]+\1\3\.Fill\( Replace with: $1auto $3 = MakeFilled<$2>\( Filters: itk*.h;itk*.hxx;itk*.cxx Directory: D:\src\ITK\Modules [v] Match case (*) Regular expression Excluded "itkVectorMeanImageFunction.hxx", because it may try to fill a `VariableLengthVector` (which is not supported by `MakeFilled`). Follow-up to pull request InsightSoftwareConsortium#4891 commit d6c9eed "STYLE: Replace Fill calls with `auto var = itk::MakeFilled<T>` in tests"
Using Notepad++, Replace in Files, doing: Find what: ^( [ ]+)([^ ].*)[ ]+(\w+);[\r\n]+\1\3\.Fill\( Replace with: $1auto $3 = MakeFilled<$2>\( Filters: itk*.h;itk*.hxx;itk*.cxx Directory: D:\src\ITK\Modules [v] Match case (*) Regular expression Excluded "itkVectorMeanImageFunction.hxx", because it may try to fill a `VariableLengthVector` (which is not supported by `MakeFilled`). Follow-up to pull request InsightSoftwareConsortium#4891 commit d6c9eed "STYLE: Replace Fill calls with `auto var = itk::MakeFilled<T>` in tests"
Using Notepad++, Replace in Files, doing: Find what: ^( [ ]+)([^ ].*)[ ]+(\w+);[\r\n]+\1\3\.Fill\( Replace with: $1auto $3 = MakeFilled<$2>\( Filters: itk*.h;itk*.hxx;itk*.cxx Directory: D:\src\ITK\Modules [v] Match case (*) Regular expression Excluded "itkVectorMeanImageFunction.hxx", because it may try to fill a `VariableLengthVector` (which is not supported by `MakeFilled`). Follow-up to pull request #4891 commit d6c9eed "STYLE: Replace Fill calls with `auto var = itk::MakeFilled<T>` in tests"
- Following ITK pull request InsightSoftwareConsortium/ITK#4891 commit InsightSoftwareConsortium/ITK@d6c9eed
- Following ITK pull request InsightSoftwareConsortium/ITK#4891 commit InsightSoftwareConsortium/ITK@d6c9eed
Replaced code of the form
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:
Follow-up to
Fill(0)
with{}
initializer for local variables in tests #4881Fill(0.)
andFill(0u)
with{}
initializer for local variables in tests #4884Fill(T{})
with{}
initialization, replaceT var; var.Fill
withauto var = T::Filled
in tests #4887