Skip to content

Use trailing return type instead of typename in "*.h" files and multi-line member function declarations#4032

Merged
hjmjohnson merged 3 commits intoInsightSoftwareConsortium:masterfrom
N-Dekker:Trailing-return-types-h-files-and-multi-line-declarations
Apr 30, 2023
Merged

Use trailing return type instead of typename in "*.h" files and multi-line member function declarations#4032
hjmjohnson merged 3 commits intoInsightSoftwareConsortium:masterfrom
N-Dekker:Trailing-return-types-h-files-and-multi-line-declarations

Conversation

@N-Dekker
Copy link
Copy Markdown
Contributor

@N-Dekker N-Dekker commented Apr 28, 2023

Did Notepad++ v8.4.8, Find in Files (Regular expression enabled):

    Find what: ^typename (\w+<.+>::)(.+)\r\n\1(.+)\r\n{\r\n
    Replace with: auto\r\n$1$3 -> $2\r\n{\r\n

    Find what: ^inline typename (\w+<.+>::)(.+)\r\n\1(.+)\r\n{\r\n
    Replace with: inline auto\r\n$1$3 -> $2\r\n{\r\n

Specifically for "itk*.h" files

In accordance with ITKSoftwareGuide pull request InsightSoftwareConsortium/ITKSoftwareGuide#162
commit InsightSoftwareConsortium/ITKSoftwareGuide@c64b23b
"ENH: Add "Trailing Return Types" section"

Follow-up to pull request InsightSoftwareConsortium#4026
commit f048a5b "STYLE: Use trailing return type
for declarations containing "inline""
Did search for return types of template member functions matching the regular
expression `^inline typename (\w+<.+>::)` and manually replaced them with
trailing return types, when possible.

Follow-up to pull request InsightSoftwareConsortium#4026
commit f048a5b "STYLE: Use trailing return type
for declarations containing "inline""
Replaced `typename` with trailing return types in multi-line template member
function declarations.

Did so by Notepad++ v8.4.8, Find in Files:

    Find what: ^typename (\w+<.+>::)(.+)\r\n\1((.+\r\n)+?){\r\n
    Replace with: auto\r\n$1$3 -> $2\r\n{\r\n
    Filters: itk*.hxx;itk*.h;itk*.cxx
    [v] Match case
    (*) Regular expression

Manually fixed two `CopyDisplacementField` member functions, which still needed
a `typename` keyword anyway.

In accordance with ITKSoftwareGuide pull request InsightSoftwareConsortium/ITKSoftwareGuide#162
commit InsightSoftwareConsortium/ITKSoftwareGuide@c64b23b
"ENH: Add "Trailing Return Types" section"

Follow-up to pull request InsightSoftwareConsortium#4026
commit f048a5b "STYLE: Use trailing return type
for declarations containing "inline""
@N-Dekker N-Dekker requested a review from dzenanz April 28, 2023 11:22
@github-actions github-actions Bot added area:Python wrapping Python bindings for a class 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 area:Numerics Issues affecting the Numerics module labels Apr 28, 2023
@N-Dekker N-Dekker marked this pull request as ready for review April 28, 2023 15:53
@hjmjohnson hjmjohnson merged commit f7fa269 into InsightSoftwareConsortium:master Apr 30, 2023
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:Python wrapping Python bindings for a class area:Registration Issues affecting the Registration module area:Segmentation Issues affecting the Segmentation module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants