Use trailing return type instead of typename in "*.h" files and multi-line member function declarations#4032
Merged
hjmjohnson merged 3 commits intoInsightSoftwareConsortium:masterfrom Apr 30, 2023
Conversation
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""
dzenanz
approved these changes
Apr 28, 2023
hjmjohnson
approved these changes
Apr 30, 2023
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.
In accordance with ITKSoftwareGuide:
Follow-up to:
Interesting... less code, but more lines of code 😸