Skip to content

Commit 4708bb7

Browse files
committed
STYLE: Remove redundant typename in type aliases
Refactor code to remove redundant `typename` specifiers in type aliases where unnecessary. Simplifies type definitions for improved readability and consistency while adhering to modern C++ practices. 'typename; is redundant before non-dependent names as of c++17
1 parent 3197b6d commit 4708bb7

File tree

221 files changed

+516
-552
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

221 files changed

+516
-552
lines changed

Examples/Filtering/SpatialObjectToImage1.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,9 @@ main(int argc, char * argv[])
186186
// Software Guide : BeginCodeSnippet
187187
ellipse->SetRadiusInObjectSpace(size[0] * 0.2 * spacing[0]);
188188

189-
typename TubeType::PointType point;
190-
typename TubeType::TubePointType tubePoint;
191-
typename TubeType::TubePointListType tubePointList;
189+
TubeType::PointType point;
190+
TubeType::TubePointType tubePoint;
191+
TubeType::TubePointListType tubePointList;
192192
point[0] = size[0] * 0.2 * spacing[0];
193193
point[1] = size[1] * 0.2 * spacing[1];
194194
point[2] = size[2] * 0.2 * spacing[2];

Examples/Filtering/SpatialObjectToImage3.cxx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,21 +142,21 @@ main(int argc, char * argv[])
142142
// Software Guide : EndLatex
143143

144144
// Software Guide : BeginCodeSnippet
145-
constexpr unsigned int numberOfPoints = 6;
146-
typename PolygonType::PointType point;
147-
typename PolygonType::PointType::VectorType radial;
145+
constexpr unsigned int numberOfPoints = 6;
146+
PolygonType::PointType point;
147+
PolygonType::PointType::VectorType radial;
148148
radial[0] = 0.0;
149149
radial[1] = 0.0;
150150
radial[2] = 0.0;
151151

152-
typename PolygonType::PointType center;
152+
PolygonType::PointType center;
153153
center[0] = 50.0;
154154
center[1] = 50.0;
155155
center[2] = 0.0;
156156

157157
constexpr double radius = 40.0;
158158

159-
typename PolygonType::PolygonPointType polygonPoint;
159+
PolygonType::PolygonPointType polygonPoint;
160160

161161
for (unsigned int i = 0; i < numberOfPoints; ++i)
162162
{

Modules/Core/Common/include/itkAnatomicalOrientation.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -563,16 +563,16 @@ class ITKCommon_EXPORT AnatomicalOrientation
563563

564564
/** Outputs unambiguous anatomical orientation names such as "right-to-left". */
565565
ITKCommon_EXPORT std::ostream &
566-
operator<<(std::ostream & out, typename AnatomicalOrientation::CoordinateEnum value);
566+
operator<<(std::ostream & out, AnatomicalOrientation::CoordinateEnum value);
567567

568568
/** Outputs the PositiveEnum encoding as a string such as "LPS". */
569569
ITKCommon_EXPORT std::ostream &
570-
operator<<(std::ostream & out, typename AnatomicalOrientation::PositiveEnum value);
570+
operator<<(std::ostream & out, AnatomicalOrientation::PositiveEnum value);
571571

572572

573573
/** Outputs the NegativeEnum encoding as a string such as "RAI" */
574574
ITKCommon_EXPORT std::ostream &
575-
operator<<(std::ostream & out, typename AnatomicalOrientation::NegativeEnum value);
575+
operator<<(std::ostream & out, AnatomicalOrientation::NegativeEnum value);
576576

577577
ITKCommon_EXPORT std::ostream &
578578
operator<<(std::ostream & out, const AnatomicalOrientation & orientation);

Modules/Core/Common/include/itkCompensatedSummation.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ CompensatedSummation<TFloat>::GetSum() const -> const AccumulateType &
142142

143143

144144
template <typename TFloat>
145-
CompensatedSummation<TFloat>::operator typename CompensatedSummation<TFloat>::FloatType() const
145+
CompensatedSummation<TFloat>::operator FloatType() const
146146
{
147147
return this->m_Sum;
148148
}

Modules/Core/Common/include/itkFloodFilledFunctionConditionalConstIterator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class ITK_TEMPLATE_EXPORT FloodFilledFunctionConditionalConstIterator : public C
5252
using IndexType = typename TImage::IndexType;
5353

5454
/** Index ContainerType */
55-
using SeedsContainerType = typename std::vector<IndexType>;
55+
using SeedsContainerType = std::vector<IndexType>;
5656

5757
/** Size type alias support. */
5858
using SizeType = typename TImage::SizeType;

Modules/Core/Common/include/itkFloodFilledFunctionConditionalConstIterator.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ void
105105
FloodFilledFunctionConditionalConstIterator<TImage, TFunction>::FindSeedPixel()
106106
{
107107
// Create an iterator that will walk the input image
108-
using IRIType = typename itk::ImageRegionConstIterator<TImage>;
108+
using IRIType = itk::ImageRegionConstIterator<TImage>;
109109

110110
// Now we search the input image for the first pixel which is inside
111111
// the function of interest

Modules/Core/Common/src/itkAnatomicalOrientation.cxx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ AnatomicalOrientation::CreateFromPositiveStringEncoding(std::string str)
7979
{
8080
std::transform(str.begin(), str.end(), str.begin(), ::toupper);
8181

82-
const std::map<std::string, typename AnatomicalOrientation::PositiveEnum> & stringToCode = GetStringToCode();
83-
auto iter = stringToCode.find(str);
82+
const std::map<std::string, AnatomicalOrientation::PositiveEnum> & stringToCode = GetStringToCode();
83+
auto iter = stringToCode.find(str);
8484
if (iter == stringToCode.end())
8585
{
8686
return { PositiveEnum::INVALID };
@@ -136,7 +136,7 @@ AnatomicalOrientation::GetCoordinateTerm(CoordinateMajornessTermsEnum cmt) const
136136
}
137137

138138

139-
const std::map<typename AnatomicalOrientation::PositiveEnum, std::string> &
139+
const std::map<AnatomicalOrientation::PositiveEnum, std::string> &
140140
AnatomicalOrientation::GetCodeToString()
141141
{
142142
auto createCodeToString = []() -> std::map<PositiveEnum, std::string> {
@@ -247,7 +247,7 @@ AnatomicalOrientation::ConvertDirectionToPositiveEnum(const DirectionType & dir)
247247
}
248248

249249

250-
typename AnatomicalOrientation::DirectionType
250+
AnatomicalOrientation::DirectionType
251251
AnatomicalOrientation::ConvertPositiveEnumToDirection(PositiveEnum orientationEnum)
252252
{
253253
const AnatomicalOrientation o(orientationEnum);
@@ -281,7 +281,7 @@ AnatomicalOrientation::ConvertPositiveEnumToDirection(PositiveEnum orientationEn
281281
}
282282

283283
std::ostream &
284-
operator<<(std::ostream & out, typename AnatomicalOrientation::CoordinateEnum value)
284+
operator<<(std::ostream & out, AnatomicalOrientation::CoordinateEnum value)
285285
{
286286
switch (value)
287287
{
@@ -305,13 +305,13 @@ operator<<(std::ostream & out, typename AnatomicalOrientation::CoordinateEnum va
305305
}
306306

307307
std::ostream &
308-
operator<<(std::ostream & out, typename AnatomicalOrientation::PositiveEnum value)
308+
operator<<(std::ostream & out, AnatomicalOrientation::PositiveEnum value)
309309
{
310310
return out << AnatomicalOrientation(value).GetAsPositiveStringEncoding();
311311
}
312312

313313
std::ostream &
314-
operator<<(std::ostream & out, typename AnatomicalOrientation::NegativeEnum value)
314+
operator<<(std::ostream & out, AnatomicalOrientation::NegativeEnum value)
315315
{
316316
return out << AnatomicalOrientation(value).GetAsNegativeStringEncoding();
317317
}

Modules/Core/Common/test/itkAnnulusOperatorTest.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,15 @@ itkAnnulusOperatorTest(int, char *[])
118118
annulus.SetThickness(thickness);
119119
ITK_TEST_SET_GET_VALUE(thickness, annulus.GetThickness());
120120

121-
constexpr typename OperatorType::PixelType exteriorValue{ 1 };
121+
constexpr OperatorType::PixelType exteriorValue{ 1 };
122122
annulus.SetExteriorValue(exteriorValue);
123123
ITK_TEST_SET_GET_VALUE(exteriorValue, annulus.GetExteriorValue());
124124

125-
constexpr typename OperatorType::PixelType annulusValue{ 8 };
125+
constexpr OperatorType::PixelType annulusValue{ 8 };
126126
annulus.SetAnnulusValue(annulusValue);
127127
ITK_TEST_SET_GET_VALUE(annulusValue, annulus.GetAnnulusValue());
128128

129-
constexpr typename OperatorType::PixelType interiorValue{ 4 };
129+
constexpr OperatorType::PixelType interiorValue{ 4 };
130130
annulus.SetInteriorValue(interiorValue);
131131
ITK_TEST_SET_GET_VALUE(interiorValue, annulus.GetInteriorValue());
132132

Modules/Core/Common/test/itkConstShapedNeighborhoodIteratorTest.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ template <typename ImageType>
519519
class MyDerivedCSNI : public itk::ConstShapedNeighborhoodIterator<ImageType>
520520
{
521521
public:
522-
using Superclass = typename itk::ConstShapedNeighborhoodIterator<ImageType>;
522+
using Superclass = itk::ConstShapedNeighborhoodIterator<ImageType>;
523523
using typename Superclass::SizeType;
524524
using typename Superclass::IndexType;
525525
using typename Superclass::RadiusType;

Modules/Core/Common/test/itkConstShapedNeighborhoodIteratorTest2.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ template <typename ImageType>
2727
class MyDerivedCSNI : public itk::ConstShapedNeighborhoodIterator<ImageType>
2828
{
2929
public:
30-
using Superclass = typename itk::ConstShapedNeighborhoodIterator<ImageType>;
30+
using Superclass = itk::ConstShapedNeighborhoodIterator<ImageType>;
3131
using typename Superclass::SizeType;
3232
using typename Superclass::IndexType;
3333
using typename Superclass::RadiusType;

0 commit comments

Comments
 (0)