Skip to content
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: Use auto for declaration of variables initialized by New() #539

Merged
merged 1 commit into from
Oct 21, 2021

Conversation

N-Dekker
Copy link
Member

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

In accordance with C++ Core Guidelines, August 19, 2021: "ES.11: Use auto to avoid redundant repetition of type names" https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-auto

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

Find what:  typename (\w+)::Pointer[ ]+(\w+) = \1::New\(\);
Replace with:  auto $2 = $1::New\(\);
Filters: itk*.hxx;itk*.h;itk*.cxx

And then again without typename:

Find what:  (\w+)::Pointer[ ]+(\w+) = \1::New\(\);

Corresponds with ITK pull request InsightSoftwareConsortium/ITK#2826

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

In accordance with C++ Core Guidelines, August 19, 2021: "ES.11: Use `auto` to avoid redundant repetition of type names" https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-auto

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

    Find what:  typename (\w+)::Pointer[ ]+(\w+) = \1::New\(\);
    Replace with:  auto $2 = $1::New\(\);
    Filters: itk*.hxx;itk*.h;itk*.cxx

And then again without `typename`:

    Find what:  (\w+)::Pointer[ ]+(\w+) = \1::New\(\);

Corresponds with ITK pull request InsightSoftwareConsortium/ITK#2826
@N-Dekker N-Dekker merged commit 54bbeec into develop Oct 21, 2021
@N-Dekker N-Dekker deleted the Use-auto-for-variables-initialized-by-New branch October 21, 2021 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant