Skip to content

Commit a50582d

Browse files
N-Dekkerhjmjohnson
authored andcommitted
STYLE: Default constructors that only initialized one member in hxx file
Removed user-defined constructors of the form: template <typename TParameter> ClassTemplate<TParameter>::ClassTemplate() : m_DataMember(initialValue) {} Defaulted each of those constructors in its header file. Added the specified initial value of the data member to its default member initializer. Cases found by Notepad++, Find in Files, doing: Find what: `^template <.+>\r\n(\w+)<.+>::\1\(\)$[\r\n]+ : m_\w+\(\w+\)[\r\n]+{}\r\n\r\n` Filters: itk*.hxx [v] Match case Search Mode: Regular expression Following C++ Core Guidelines, Jul 8, 2025, "Don’t define a default constructor that only initializes data members; use default member initializers instead", https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c45-dont-define-a-default-constructor-that-only-initializes-data-members-use-default-member-initializers-instead
1 parent fe1b4b7 commit a50582d

File tree

44 files changed

+44
-159
lines changed

Some content is hidden

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

44 files changed

+44
-159
lines changed

Modules/Core/FiniteDifference/include/itkFiniteDifferenceSparseImageFilter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class ITK_TEMPLATE_EXPORT FiniteDifferenceSparseImageFilter
114114
itkGetConstMacro(PrecomputeFlag, bool);
115115

116116
protected:
117-
FiniteDifferenceSparseImageFilter();
117+
FiniteDifferenceSparseImageFilter() = default;
118118
~FiniteDifferenceSparseImageFilter() override = default;
119119
void
120120
PrintSelf(std::ostream & os, Indent indent) const override;
@@ -206,7 +206,7 @@ class ITK_TEMPLATE_EXPORT FiniteDifferenceSparseImageFilter
206206
bool m_PrecomputeFlag{};
207207

208208
/** The Sparse function type. */
209-
SparseFunctionType * m_SparseFunction{};
209+
SparseFunctionType * m_SparseFunction{ nullptr };
210210

211211
/** A list of subregions of the active set of pixels in the sparse image
212212
which are passed to each thread for parallel processing. */

Modules/Core/FiniteDifference/include/itkFiniteDifferenceSparseImageFilter.hxx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@
2121

2222
namespace itk
2323
{
24-
template <typename TInputImageType, typename TSparseOutputImageType>
25-
FiniteDifferenceSparseImageFilter<TInputImageType, TSparseOutputImageType>::FiniteDifferenceSparseImageFilter()
26-
: m_SparseFunction(nullptr)
27-
{}
28-
2924
template <typename TInputImageType, typename TSparseOutputImageType>
3025
void
3126
FiniteDifferenceSparseImageFilter<TInputImageType, TSparseOutputImageType>::PrintSelf(std::ostream & os,

Modules/Core/ImageFunction/include/itkScatterMatrixImageFunction.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,13 @@ class ITK_TEMPLATE_EXPORT ScatterMatrixImageFunction
117117
itkGetConstReferenceMacro(NeighborhoodRadius, unsigned int);
118118
/** @ITKEndGrouping */
119119
protected:
120-
ScatterMatrixImageFunction();
120+
ScatterMatrixImageFunction() = default;
121121
~ScatterMatrixImageFunction() override = default;
122122
void
123123
PrintSelf(std::ostream & os, Indent indent) const override;
124124

125125
private:
126-
unsigned int m_NeighborhoodRadius{};
126+
unsigned int m_NeighborhoodRadius{ 1 };
127127
};
128128
} // end namespace itk
129129

Modules/Core/ImageFunction/include/itkScatterMatrixImageFunction.hxx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@
2323
namespace itk
2424
{
2525

26-
template <typename TInputImage, typename TCoordinate>
27-
ScatterMatrixImageFunction<TInputImage, TCoordinate>::ScatterMatrixImageFunction()
28-
: m_NeighborhoodRadius(1)
29-
{}
30-
3126
template <typename TInputImage, typename TCoordinate>
3227
void
3328
ScatterMatrixImageFunction<TInputImage, TCoordinate>::PrintSelf(std::ostream & os, Indent indent) const

Modules/Core/ImageFunction/include/itkVarianceImageFunction.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,13 @@ class ITK_TEMPLATE_EXPORT VarianceImageFunction
111111
itkGetConstReferenceMacro(NeighborhoodRadius, unsigned int);
112112
/** @ITKEndGrouping */
113113
protected:
114-
VarianceImageFunction();
114+
VarianceImageFunction() = default;
115115
~VarianceImageFunction() override = default;
116116
void
117117
PrintSelf(std::ostream & os, Indent indent) const override;
118118

119119
private:
120-
unsigned int m_NeighborhoodRadius{};
120+
unsigned int m_NeighborhoodRadius{ 1 };
121121
};
122122
} // end namespace itk
123123

Modules/Core/ImageFunction/include/itkVarianceImageFunction.hxx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@
2424
namespace itk
2525
{
2626

27-
template <typename TInputImage, typename TCoordinate>
28-
VarianceImageFunction<TInputImage, TCoordinate>::VarianceImageFunction()
29-
: m_NeighborhoodRadius(1)
30-
{}
31-
3227
template <typename TInputImage, typename TCoordinate>
3328
void
3429
VarianceImageFunction<TInputImage, TCoordinate>::PrintSelf(std::ostream & os, Indent indent) const

Modules/Core/ImageFunction/include/itkVectorMeanImageFunction.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,13 @@ class ITK_TEMPLATE_EXPORT VectorMeanImageFunction
113113
itkGetConstReferenceMacro(NeighborhoodRadius, unsigned int);
114114
/** @ITKEndGrouping */
115115
protected:
116-
VectorMeanImageFunction();
116+
VectorMeanImageFunction() = default;
117117
~VectorMeanImageFunction() override = default;
118118
void
119119
PrintSelf(std::ostream & os, Indent indent) const override;
120120

121121
private:
122-
unsigned int m_NeighborhoodRadius{};
122+
unsigned int m_NeighborhoodRadius{ 1 };
123123
};
124124
} // end namespace itk
125125

Modules/Core/ImageFunction/include/itkVectorMeanImageFunction.hxx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@
2424
namespace itk
2525
{
2626

27-
template <typename TInputImage, typename TCoordinate>
28-
VectorMeanImageFunction<TInputImage, TCoordinate>::VectorMeanImageFunction()
29-
: m_NeighborhoodRadius(1)
30-
{}
31-
3227
template <typename TInputImage, typename TCoordinate>
3328
void
3429
VectorMeanImageFunction<TInputImage, TCoordinate>::PrintSelf(std::ostream & os, Indent indent) const

Modules/Core/SpatialObjects/include/itkCastSpatialObjectFilter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,15 @@ class ITK_TEMPLATE_EXPORT CastSpatialObjectFilter : public Object
221221
}
222222

223223
protected:
224-
CastSpatialObjectFilter();
224+
CastSpatialObjectFilter() = default;
225225
~CastSpatialObjectFilter() override = default;
226226

227227
void
228228
PrintSelf(std::ostream & os, Indent indent) const override;
229229

230230

231231
private:
232-
typename InputSpatialObjectType::Pointer m_Input{};
232+
typename InputSpatialObjectType::Pointer m_Input{ nullptr };
233233

234234
}; // End class CastSpatialObjectFilter
235235

Modules/Core/SpatialObjects/include/itkCastSpatialObjectFilter.hxx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,6 @@
2525
namespace itk
2626
{
2727

28-
/**
29-
* Constructor
30-
*/
31-
template <unsigned int ObjectDimension>
32-
CastSpatialObjectFilter<ObjectDimension>::CastSpatialObjectFilter()
33-
: m_Input(nullptr)
34-
{}
35-
3628
/**
3729
* Print Self
3830
*/

0 commit comments

Comments
 (0)