STYLE: Replace Fill calls with auto var = itk::MakeFilled<T> in tests#4891
Merged
jhlegarreta merged 1 commit intoInsightSoftwareConsortium:masterfrom Oct 27, 2024
Conversation
Contributor
Author
|
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); 😃 |
Contributor
Author
|
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
N-Dekker
added a commit
to N-Dekker/ITK
that referenced
this pull request
Oct 26, 2024
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"
N-Dekker
added a commit
to N-Dekker/ITK
that referenced
this pull request
Oct 31, 2024
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"
N-Dekker
added a commit
to N-Dekker/ITK
that referenced
this pull request
Nov 1, 2024
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"
dzenanz
pushed a commit
that referenced
this pull request
Nov 4, 2024
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"
N-Dekker
added a commit
to SuperElastix/elastix
that referenced
this pull request
Nov 15, 2024
- Following ITK pull request InsightSoftwareConsortium/ITK#4891 commit InsightSoftwareConsortium/ITK@d6c9eed
N-Dekker
added a commit
to SuperElastix/elastix
that referenced
this pull request
Nov 15, 2024
- Following ITK pull request InsightSoftwareConsortium/ITK#4891 commit InsightSoftwareConsortium/ITK@d6c9eed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.Fillwithauto var = T::Filledin tests #4887