STYLE: Replace T var{ NumericTraits<T>::ZeroValue() } with T var{}#4017
Merged
dzenanz merged 1 commit intoInsightSoftwareConsortium:masterfrom Apr 20, 2023
Conversation
Replaced brace-initialization by `NumericTraits<T>::ZeroValue()` with empty `{}`
initializers. Did so by Replace in Files, using regular expressions:
Find what: (\w.+)( .+){ NumericTraits<\1>::ZeroValue\(\) };
Replace with: $1$2{};
Follow-up to pull request InsightSoftwareConsortium#3958
commit 42b0bfc
"STYLE: Replace `T var = NumericTraits<T>::ZeroValue()` with `T var{}`"
dzenanz
approved these changes
Apr 19, 2023
N-Dekker
added a commit
to N-Dekker/ITK
that referenced
this pull request
Feb 12, 2024
For any type 'T` that is supported by `NumericTraits<T>`, the expression
`NumericTraits<T>::ZeroValue()` is just equivalent to `T{}`. `T{}` is preferred,
because it is more generic, and it may yield faster code than the corresponding
`NumericTraits<T>::ZeroValue()` function call.
Using Notepad++ Replace in Files:
Find what: itk::NumericTraits<(\w+)>::ZeroValue\(\)
Find what: NumericTraits<(\w+)>::ZeroValue\(\)
Replace with: $1{}
Filters: itk*.hxx;itk*.h;itk*.cxx
Directory: ITK\Modules
[v] Match case
(*) Regular expression
Excluded "itkNumericTraitsTest.cxx", because it is meant to test
`NumericTraits::ZeroValue()`.
Follow-up to pull request InsightSoftwareConsortium#4017
commit 5ac803e
"STYLE: Replace `T var{ NumericTraits<T>::ZeroValue() }` with `T var{}`"
N-Dekker
added a commit
to N-Dekker/ITK
that referenced
this pull request
Feb 12, 2024
For any type `T` that is supported by `NumericTraits<T>`, the expression
`NumericTraits<T>::ZeroValue()` is just equivalent to `T{}`. `T{}` is preferred,
because it is more generic, and it may yield faster code than the corresponding
`NumericTraits<T>::ZeroValue()` function call.
Using Notepad++ Replace in Files:
Find what: itk::NumericTraits<(\w+)>::ZeroValue\(\)
Find what: NumericTraits<(\w+)>::ZeroValue\(\)
Replace with: $1{}
Filters: itk*.hxx;itk*.h;itk*.cxx
Directory: ITK\Modules
[v] Match case
(*) Regular expression
Excluded "itkNumericTraitsTest.cxx", because it is meant to test
`NumericTraits::ZeroValue()`.
Follow-up to pull request InsightSoftwareConsortium#4017
commit 5ac803e
"STYLE: Replace `T var{ NumericTraits<T>::ZeroValue() }` with `T var{}`"
N-Dekker
added a commit
to N-Dekker/ITK
that referenced
this pull request
Feb 12, 2024
For any type `T` that is supported by `NumericTraits<T>`, the expression
`NumericTraits<T>::ZeroValue()` is just equivalent to `T{}`. `T{}` appears
preferred, because it is more generic, and it may yield faster code than the
corresponding `NumericTraits<T>::ZeroValue()` function call.
Using Notepad++, Replace in Files:
Find what: itk::NumericTraits<(\w+)>::ZeroValue\(\)
Find what: NumericTraits<(\w+)>::ZeroValue\(\)
Replace with: $1{}
Filters: itk*.hxx;itk*.h;itk*.cxx
Directory: ITK\Modules
[v] Match case
(*) Regular expression
Excluded "itkNumericTraitsTest.cxx", because it purposely calls
`NumericTraits::ZeroValue()` as part of the test.
Follow-up to pull request InsightSoftwareConsortium#4017
commit 5ac803e
"STYLE: Replace `T var{ NumericTraits<T>::ZeroValue() }` with `T var{}`"
N-Dekker
added a commit
to N-Dekker/ITK
that referenced
this pull request
Feb 13, 2024
For any type `T` that is supported by `NumericTraits<T>`, the expression
`NumericTraits<T>::ZeroValue()` is just equivalent to `T{}`. `T{}` appears
preferable, because it is more generic, and it may yield faster code than the
corresponding `NumericTraits<T>::ZeroValue()` function call.
Using Notepad++, Replace in Files:
Find what:
itk::NumericTraits<(\w+)>::ZeroValue\(\)
NumericTraits<(\w+)>::ZeroValue\(\)
itk::NumericTraits<([^ <>]+)>::ZeroValue\(\)
NumericTraits<([^ <>]+)>::ZeroValue\(\)
itk::NumericTraits<(typename [^ <>]+)>::ZeroValue\(\)
NumericTraits<(typename [^ <>]+)>::ZeroValue\(\)
itk::NumericTraits<(itk::NumericTraits<[^ ]+>::ValueType)>::ZeroValue\(\)
itk::NumericTraits<(typename itk::NumericTraits<[^ ]+>::ValueType)>::ZeroValue\(\)
NumericTraits<(typename NumericTraits<[^ ]+>::ValueType)>::ZeroValue\(\)
itk::NumericTraits<(typename .+)>::ZeroValue\(\)
NumericTraits<(typename .+)>::ZeroValue\(\)
Replace with: $1{}
Filters: itk*.hxx;itk*.h;itk*.cxx
Directory: ITK\Modules
[v] Match case
(*) Regular expression
Excluded "itkNumericTraitsTest.cxx", because it purposely calls
`NumericTraits::ZeroValue()` as part of the test.
Follow-up to pull request InsightSoftwareConsortium#4017
commit 5ac803e
"STYLE: Replace `T var{ NumericTraits<T>::ZeroValue() }` with `T var{}`"
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 brace-initialization by
NumericTraits<T>::ZeroValue()with empty{}initializers. Did so by Replace in Files, using regular expressions:Follow-up to pull request #3958 commit 42b0bfc
"STYLE: Replace
T var = NumericTraits<T>::ZeroValue()withT var{}"