Skip to content

STYLE: Use auto for declaration of variables initialized by New() #367

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

Merged
merged 1 commit into from
May 20, 2022

Conversation

N-Dekker
Copy link
Collaborator

Replaced initializations of the forms T::Pointer var = T::New() and
typename T::Pointer var = T::New() with auto var = T::New(), to reduce
code redundancy.

Using Notepad++ v8.3.3, Find in Files (Regular expression):

Find what:  typename (\w+)::Pointer[ ]+(\w+) = \1::New\(\);
Replace with:  auto $2 = $1::New\(\);

And then again without typename.

Following ITK pull request InsightSoftwareConsortium/ITK#2994
commit InsightSoftwareConsortium/ITK@2f291f8
"STYLE: Use auto for variables initialized by New() in Examples",
by Jon Haitz Legarreta Gorroño (@jhlegarreta), merged on 27 December 2021.

Replaced initializations of the forms `T::Pointer var = T::New()` and
`typename T::Pointer var = T::New()` with `auto var = T::New()`, to reduce
code redundancy.

Using Notepad++ v8.3.3, Find in Files (Regular expression):

  Find what:  typename (\w+)::Pointer[ ]+(\w+) = \1::New\(\);
  Replace with:  auto $2 = $1::New\(\);

And then again without `typename`.

Following ITK pull request InsightSoftwareConsortium/ITK#2994
commit InsightSoftwareConsortium/ITK@2f291f8
"STYLE: Use `auto` for variables initialized by `New()` in Examples",
by Jon Haitz Legarreta Gorroño, merged on 27 December 2021.
@github-actions github-actions bot added area:Bridge Issues affecting the Bridge module area:Core Issues affecting the Core module area:Filtering Issues affecting the Filtering module area:IO Issues affecting the IO module area:Nonunit Issues affecting the Nonunit module area:Numerics Issues affecting the Numerics module area:Registration Issues affecting the Registration module area:Remotes Issues affecting the Remote module area:Segmentation Issues affecting the Segmentation module area:Video Issues affecting the Video module language:C++ Changes to C++ examples type:Style Style changes: no logic impact (indentation, comments, naming) labels May 19, 2022
@N-Dekker N-Dekker marked this pull request as ready for review May 19, 2022 12:05
Copy link
Member

@thewtex thewtex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@thewtex thewtex merged commit 315d357 into InsightSoftwareConsortium:master May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:Bridge Issues affecting the Bridge module area:Core Issues affecting the Core module area:Filtering Issues affecting the Filtering module area:IO Issues affecting the IO module area:Nonunit Issues affecting the Nonunit module area:Numerics Issues affecting the Numerics module area:Registration Issues affecting the Registration module area:Remotes Issues affecting the Remote module area:Segmentation Issues affecting the Segmentation module area:Video Issues affecting the Video module language:C++ Changes to C++ examples type:Style Style changes: no logic impact (indentation, comments, naming)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants