Commit 66e5d6b
committed
STYLE: Prefer C++11 type alias over typedef
== http://en.cppreference.com/w/cpp/language/type_alias ==
Type alias is a name that refers to a previously defined type (similar
to typedef).
A type alias declaration introduces a name which can be used as a
synonym for the type denoted by type-id. It does not introduce a new
type and it cannot change the meaning of an existing type name. There is
no difference between a type alias declaration and typedef declaration.
This declaration may appear in block scope, class scope, or namespace
scope.
== https://www.quora.com/Is-using-typedef-in-C++-considered-a-bad-practice ==
While typedef is still available for backward compatibility, the new
Type Alias syntax 'using Alias = ExistingLongName;' is more consistent
with the flow of C++ than the old typedef syntax 'typedef
ExistingLongName Alias;', and it also works for templates (Type alias,
alias template (since C++11)), so leftover 'typedef' aliases will differ
in style from any alias templates.
======= First pass regex manual changes ==================
cat > /tmp/typdef_vim_script.vim << EOF
:%s/typedef *\(.*<\_s*.*[>,]\_s*.*[><,]\_s*.*[><,]\_s*.*[><,]\_s*.*[><,]\_s*.*[^>]>\)\_s *\([A-Za-z0-9][A-Za-z0-9]*\);\{-};/using \2 = \1;/ge
:%s/typedef *\(.*<\_s*.*[><,]\_s*.*[><,]\_s*.*[><,]\_s*.*[><,]\_s*.*[^>]>\)\_s *\([A-Za-z0-9][A-Za-z0-9]*\);\{-};/using \2 = \1;/ge
:%s/typedef *\(.*<\_s*.*[><,]\_s*.*[><,]\_s*.*[><,]\_s*.*[^>]>\)\_s *\([A-Za-z0-9][A-Za-z0-9]*\);\{-};/using \2 = \1;/ge
:%s/typedef *\(.*<\_s*.*[><,]\_s*.*[><,]\_s*.*[^>]>\)\_s *\([A-Za-z0-9][A-Za-z0-9]*\);\{-};/using \2 = \1;/ge
:%s/typedef *\(.*<\_s*.*[><,]\_s*.*[^>]>\)\_s *\([A-Za-z0-9][A-Za-z0-9]*\);\{-};/using \2 = \1;/ge
:%s/typedef *\(.*<\_s*.*[^>]>\)\_s *\([A-Za-z0-9][A-Za-z0-9]*\);\{-};/using \2 = \1;/ge
:%s/\*\(.*\) typedef\(s*\)\(.*\)\*/*\1 type alias\3*/ge
:%s/\*\*\(.*\) typedef\(s*\)\(.*\)/**\1 type alias\3/ge
:%s/\/\/\(.*\)typedefs/\/\/\1type alias/ge
:%s/typedef *\(.*<\_s*.*,\_s*.*,\_s*[^>]*>\) *\([A-Za-z0-9][A-Za-z0-9]*\);\{-};/using \2 = \1;/ge
:%s/\/\/\(.*\)typedefs/\/\/\1type alias/ge
:%s/typedef *\(.*<\_s*.*[>,]\_s.*[^>]>\)\_s *\([A-Za-z0-9][A-Za-z0-9]*\);\{-};/using \2 = \1;/ge
:%s/\*\(.*\) typedef\(s*\)\(.*\)\*/*\1 type alias\3*/ge
:%s/\*\*\(.*\) typedef\(s*\)\(.*\)/**\1 type alias\3/ge
:%s/typedef *\(.*[><,]*\_s*.*[><,]\_s.*[^>]>\)\_s *\([A-Za-z0-9][A-Za-z0-9]*\);\{-};/using \2 = \1;/ge
:%s/typedef *\(.*<\_s*.*[>,]\_s*.*[><,]\_s*.*[><,]\_s*.*[^>]>\)\_s *\([A-Za-z0-9][A-Za-z0-9]*\);\{-};/using \2 = \1;/ge
:%s/typedef *\(.*<\_s*.*[>,]\_s*.*[><,]\_s*.*[><,]\_s*.*[><,]\_s*.*[><,]\_s*.*[^>]>\)\_s *\([A-Za-z0-9][A-Za-z0-9]*\);\{-};/using \2 = \1;/ge
:%s/typedef *\(.*\) * \([a-zA-Z0-9]*\);/using \2 = \1;/g
:%s/typedef *\(.*<\_s*.*,\n[^>]*>\) *\([A-Za-z0-9][A-Za-z0-9]*\);\{-};/using \2 = \1;/ge
:%s/typedef *\(.*<\_s*.*,.*>\{-}>\) *\([A-Za-z0-9][A-Za-z0-9]*\);\{-};/using \2 = \1;/ge
:%s/\( *\)typedef *\(.*<.*>\)\_s\( *\)\([A-Za-z0-9][A-Za-z0-9]*\);\{-};/\1using \4 =\r\1 \2;/ge
:%s/typedef support\(\.*\)/type alias support/ge
:%s/ *;/;/ge
:w
:q
EOF
for ff in $(git grep -l "typedef" |fgrep -v ThirdParty |head -n 1500); do
vim -S /tmp/typdef_vim_script.vim $ff;
done
clang-tidy -header-filter=.* \
-checks=-*,modernize-use-using \
-fix -p=~/Dashboard/src/ITK-clangtidy \
$(git grep -l typedef |fgrep -v ThirdParty|fgrep "cxx")
Change-Id: I7d121a71b220e74337ec7626c6b4f53b61c64c531 parent d0610e3 commit 66e5d6b
4,144 files changed
Lines changed: 49924 additions & 51120 deletions
File tree
- Documentation/Doxygen
- Examples
- DataRepresentation
- Containers
- Image
- Mesh
- Path
- Filtering
- IO
- XML
- Installation
- Iterators
- Numerics
- RegistrationITKv3
- RegistrationITKv4
- Segmentation
- SpatialObjects
- Statistics
- Modules
- Bridge
- VTK/include
- VtkGlue
- include
- src
- test
- Core
- Common
- include
- src
- test
- FiniteDifference/include
- GPUCommon
- include
- test
- GPUFiniteDifference/include
- ImageAdaptors
- include
- test
- ImageFunction
- include
- test
- Mesh
- include
- test
- QuadEdgeMesh
- include
- test
- SpatialObjects
- include
- src
- test
- TestKernel
- include
- test
- Transform
- include
- test
- Filtering
- AnisotropicSmoothing
- include
- test
- AntiAlias
- include
- test
- BiasCorrection
- include
- test
- BinaryMathematicalMorphology
- include
- test
- Colormap
- include
- test
- Convolution
- include
- test
- CurvatureFlow
- include
- test
- Deconvolution
- include
- test
- Denoising
- include
- test
- DiffusionTensorImage
- include
- test
- DisplacementField
- include
- test
- DistanceMap
- include
- test
- FFT
- include
- test
- FastMarching
- include
- test
- GPUAnisotropicSmoothing
- include
- test
- GPUImageFilterBase
- include
- test
- GPUSmoothing
- include
- test
- GPUThresholding
- include
- test
- ImageCompare
- include
- test
- ImageCompose
- include
- test
- ImageFeature
- include
- test
- ImageFilterBase
- include
- test
- ImageFusion
- include
- test
- ImageGradient
- include
- test
- ImageGrid
- include
- test
- ImageIntensity
- include
- test
- ImageLabel
- include
- test
- ImageNoise
- include
- test
- ImageSources
- include
- test
- ImageStatistics
- include
- test
- LabelMap
- include
- test
- MathematicalMorphology
- include
- test
- Path
- include
- test
- QuadEdgeMeshFiltering
- include
- test
- Smoothing
- include
- test
- SpatialFunction
- include
- test
- Thresholding
- include
- test
- IO
- BMP
- include
- test
- BioRad
- include
- test
- Bruker
- include
- test
- CSV
- include
- test
- DCMTK
- include
- test
- GDCM
- include
- src
- test
- GE
- include
- test
- GIPL
- include
- test
- HDF5
- include
- src
- test
- IPL
- include
- src
- ImageBase
- include
- src
- test
- JPEG
- include
- test
- LSM
- include
- src
- test
- MINC
- include
- test
- MRC
- include
- src
- test
- Mesh
- include
- test
- Meta
- include
- test
- NIFTI
- include
- src
- test
- NRRD
- include
- test
- PNG
- include
- test
- PhilipsREC
- include
- src
- test
- RAW
- include
- test
- Siemens/include
- SpatialObjects
- include
- test
- Stimulate
- include
- test
- TIFF
- include
- src
- test
- TransformBase
- include
- src
- test
- TransformFactory/include
- TransformHDF5
- include
- test
- TransformInsightLegacy
- include
- test
- TransformMINC
- include
- test
- TransformMatlab
- include
- test
- VTK
- include
- src
- test
- XML
- include
- src
- test
- Nonunit
- IntegratedTest/test
- Review
- include
- src
- test
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | | - | |
70 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
| 188 | + | |
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | | - | |
| 66 | + | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
265 | | - | |
266 | | - | |
| 265 | + | |
| 266 | + | |
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
258 | | - | |
| 258 | + | |
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
| |||
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
386 | | - | |
| 386 | + | |
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
| |||
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
399 | | - | |
| 399 | + | |
400 | 400 | | |
401 | 401 | | |
402 | 402 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
240 | | - | |
| 240 | + | |
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
| 62 | + | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
108 | 108 | | |
109 | | - | |
| 109 | + | |
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
| 122 | + | |
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
| 154 | + | |
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | | - | |
| 55 | + | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
| 103 | + | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
106 | 106 | | |
107 | | - | |
108 | | - | |
| 107 | + | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
| 153 | + | |
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
217 | | - | |
| 216 | + | |
| 217 | + | |
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
240 | | - | |
241 | | - | |
| 240 | + | |
| 241 | + | |
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | | - | |
| 69 | + | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
| 133 | + | |
134 | 134 | | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
155 | | - | |
| 154 | + | |
| 155 | + | |
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | | - | |
| 187 | + | |
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
| |||
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
210 | | - | |
211 | | - | |
212 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
213 | 213 | | |
214 | | - | |
| 214 | + | |
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
| |||
0 commit comments