Skip to content

STYLE: Replace T var = NumericTraits<T>::ZeroValue() with T var{}#3958

Merged
hjmjohnson merged 1 commit intoInsightSoftwareConsortium:masterfrom
N-Dekker:Replace-NumericTraits-ZeroValue-initialization
Mar 10, 2023
Merged

STYLE: Replace T var = NumericTraits<T>::ZeroValue() with T var{}#3958
hjmjohnson merged 1 commit intoInsightSoftwareConsortium:masterfrom
N-Dekker:Replace-NumericTraits-ZeroValue-initialization

Conversation

@N-Dekker
Copy link
Copy Markdown
Contributor

@N-Dekker N-Dekker commented Mar 9, 2023

Replaced initialization by NumericTraits<T>::ZeroValue() with empty {} initializers. Did so by Replace in Files, using regular expressions:

Find what: (\w+)([ ]+\w+) = NumericTraits<\1>::ZeroValue\(\);
Replace with: $1$2{};

Follow-up to pull request #3950 commmit ef5cc8c
"STYLE: Prefer C++11 zero initializer to ZeroValue", by Hans Johnson (@hjmjohnson).

Replaced initialization by `NumericTraits<T>::ZeroValue()` with empty `{}`
initializers. Did so by Replace in Files, using regular expressions:

    Find what: (\w+)([ ]+\w+) = NumericTraits<\1>::ZeroValue\(\);
    Replace with: $1$2{};

Follow-up to pull request InsightSoftwareConsortium#3950
commmit ef5cc8c
"STYLE: Prefer C++11 zero initializer to ZeroValue", by Hans Johnson.
@N-Dekker N-Dekker requested a review from hjmjohnson March 9, 2023 15:11
@github-actions github-actions bot added type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct area:Core Issues affecting the Core module area:Filtering Issues affecting the Filtering module area:IO Issues affecting the IO module area:Registration Issues affecting the Registration module area:Segmentation Issues affecting the Segmentation module type:Style Style changes: no logic impact (indentation, comments, naming) area:Numerics Issues affecting the Numerics module labels Mar 9, 2023
@N-Dekker
Copy link
Copy Markdown
Contributor Author

N-Dekker commented Mar 9, 2023

@hjmjohnson Was there a specific reason for your pull request #3950 not to address these 300+ cases? Or was it just meant to pave the way for this PR of mine? 😃

@N-Dekker N-Dekker marked this pull request as ready for review March 9, 2023 20:29
@hjmjohnson
Copy link
Copy Markdown
Member

I did what I could in the time I had. I had an insufficient regular expression to capture these cases.

@hjmjohnson hjmjohnson merged commit 42b0bfc into InsightSoftwareConsortium:master Mar 10, 2023
@N-Dekker
Copy link
Copy Markdown
Contributor Author

I did what I could in the time I had. I had an insufficient regular expression to capture these cases.

Thanks @hjmjohnson I just wanted to be sure that these cases were not skipped intentionally! 😃

N-Dekker added a commit to N-Dekker/ITK that referenced this pull request Apr 17, 2023
Replaced initialization by `NumericTraits<T>::ZeroValue()` with empty `{}`
initializers. Did so by Replace in Files, using regular expressions:

    Find what: (.+)([ ]+\w+) = NumericTraits<\1>::ZeroValue\(\);
    Find what: (.+)([ ]+\w+) = itk::NumericTraits<\1>::ZeroValue\(\);
    Find what: (.+)([ ]+\w+) =\r\n[ ]+NumericTraits<\1>::ZeroValue\(\);
    Find what: (.+)([ ]+\w+) =\r\n[ ]+itk::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{}`" (which
did not yet address initializations of which the specification of `T` has one or
more spaces inside, and initializations that took multiple lines of code.)
N-Dekker added a commit to N-Dekker/ITK that referenced this pull request Apr 17, 2023
Replaced initialization by `NumericTraits<T>::ZeroValue()` with empty `{}`
initializers. Did so by Replace in Files, using regular expressions:

    Find what: (.+)([ ]+\w+) = NumericTraits<\1>::ZeroValue\(\);
    Find what: (.+)([ ]+\w+) = itk::NumericTraits<\1>::ZeroValue\(\);
    Find what: (.+)([ ]+\w+) =\r\n[ ]+NumericTraits<\1>::ZeroValue\(\);
    Find what: (.+)([ ]+\w+) =\r\n[ ]+itk::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{}`" (which
did not yet address initializations of which the specification of `T` has one or
more spaces inside, and initializations that took multiple lines of code.)
hjmjohnson pushed a commit that referenced this pull request Apr 18, 2023
Replaced initialization by `NumericTraits<T>::ZeroValue()` with empty `{}`
initializers. Did so by Replace in Files, using regular expressions:

    Find what: (.+)([ ]+\w+) = NumericTraits<\1>::ZeroValue\(\);
    Find what: (.+)([ ]+\w+) = itk::NumericTraits<\1>::ZeroValue\(\);
    Find what: (.+)([ ]+\w+) =\r\n[ ]+NumericTraits<\1>::ZeroValue\(\);
    Find what: (.+)([ ]+\w+) =\r\n[ ]+itk::NumericTraits<\1>::ZeroValue\(\);
    Replace with: $1$2{};

Follow-up to pull request #3958
commit 42b0bfc
"STYLE: Replace `T var = NumericTraits<T>::ZeroValue()` with `T var{}`" (which
did not yet address initializations of which the specification of `T` has one or
more spaces inside, and initializations that took multiple lines of code.)
N-Dekker added a commit to N-Dekker/ITK that referenced this pull request Apr 19, 2023
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 pushed a commit that referenced this pull request Apr 20, 2023
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 #3958
commit 42b0bfc
"STYLE: Replace `T var = NumericTraits<T>::ZeroValue()` with `T var{}`"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Core Issues affecting the Core module area:Filtering Issues affecting the Filtering module area:IO Issues affecting the IO module area:Numerics Issues affecting the Numerics module area:Registration Issues affecting the Registration module area:Segmentation Issues affecting the Segmentation module type:Style Style changes: no logic impact (indentation, comments, naming) type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants