Skip to content

Commit 9190df3

Browse files
committed
STYLE: Prefer = default to explicitly trivial implementations
This check replaces default bodies of special member functions with = default;. The explicitly defaulted function declarations enable more opportunities in optimization, because the compiler might treat explicitly defaulted functions as trivial. Additionally, the C++11 use of = default more clearly expreses the intent for the special member functions.
1 parent 47b47b9 commit 9190df3

File tree

59 files changed

+64
-176
lines changed

Some content is hidden

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

59 files changed

+64
-176
lines changed

Modules/Bridge/VTK/src/itkVTKImageExportBase.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace itk
2323
* Constructor sets up information for the image-type indepenedent
2424
* callbacks implemented in this superclass.
2525
*/
26-
VTKImageExportBase::VTKImageExportBase() {}
26+
VTKImageExportBase::VTKImageExportBase() = default;
2727

2828
void
2929
VTKImageExportBase::PrintSelf(std::ostream & os, Indent indent) const

Modules/Core/Common/include/itkConditionalConstIterator.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,7 @@ class ITK_TEMPLATE_EXPORT ConditionalConstIterator
7272
/** operator= is provided to make sure the handle to the image is properly
7373
* reference counted. */
7474
Self &
75-
operator=(const Self & it)
76-
{
77-
m_IsAtEnd = it.m_IsAtEnd; // copy the end flag
78-
m_Image = it.m_Image; // copy the smart pointer
79-
m_Region = it.m_Region; // copy the region
80-
return *this;
81-
}
75+
operator=(const Self & it) = default;
8276

8377
/** Get the dimension (size) of the index. */
8478
static unsigned int

Modules/Core/Common/include/itkConstShapedNeighborhoodIterator.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,7 @@ class ITK_TEMPLATE_EXPORT ConstShapedNeighborhoodIterator : private Neighborhood
127127
~ConstIterator() = default;
128128

129129
ConstIterator &
130-
operator=(const ConstIterator & o)
131-
{
132-
m_NeighborhoodIterator = o.m_NeighborhoodIterator;
133-
m_ListIterator = o.m_ListIterator;
134-
return *this;
135-
}
130+
operator=(const ConstIterator & o) = default;
136131

137132
ConstIterator(const ConstIterator & o)
138133
: m_NeighborhoodIterator(o.m_NeighborhoodIterator)

Modules/Core/Common/include/itkDataObjectConstIterator.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,7 @@ class DataObjectConstIterator
3434

3535
DataObjectConstIterator() = default;
3636

37-
DataObjectConstIterator(const DataObjectConstIterator & iter)
38-
: m_Iterator(iter.m_Iterator)
39-
, m_Begin(iter.m_Begin)
40-
, m_End(iter.m_End)
41-
{}
37+
DataObjectConstIterator(const DataObjectConstIterator & iter) = default;
4238

4339
DataObjectConstIterator &
4440
operator=(const DataObjectConstIterator & iter)

Modules/Core/Common/include/itkDataObjectIterator.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,7 @@ class DataObjectIterator
3434

3535
DataObjectIterator() = default;
3636

37-
DataObjectIterator(const DataObjectIterator & iter)
38-
: m_Iterator(iter.m_Iterator)
39-
, m_Begin(iter.m_Begin)
40-
, m_End(iter.m_End)
41-
{}
37+
DataObjectIterator(const DataObjectIterator & iter) = default;
4238

4339
DataObjectIterator &
4440
operator=(const DataObjectIterator & iter)

Modules/Core/Common/include/itkImageRandomNonRepeatingConstIteratorWithIndex.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class NodeOfPermutation
4444
SizeValueType m_Index{ 0 };
4545
double m_Value{ 0.0 };
4646

47-
NodeOfPermutation() {}
47+
NodeOfPermutation() = default;
4848

4949
bool
5050
operator<(const NodeOfPermutation & b) const

Modules/Core/Common/include/itkVariableSizeMatrix.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,7 @@ class ITK_TEMPLATE_EXPORT VariableSizeMatrix
203203

204204
/** Assignment operator. */
205205
inline Self &
206-
operator=(const Self & matrix)
207-
{
208-
m_Matrix = matrix.m_Matrix;
209-
return *this;
210-
}
206+
operator=(const Self & matrix) = default;
211207

212208
/** Return the inverse matrix. */
213209
inline vnl_matrix<T>

Modules/Core/Common/src/itkDataObject.cxx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ DataObjectError::DataObjectError(std::string file, unsigned int lineNumber)
4343
: ExceptionObject(std::move(file), lineNumber)
4444
{}
4545

46-
DataObjectError::DataObjectError(const DataObjectError & orig) noexcept
47-
: ExceptionObject(orig)
48-
, m_DataObject(orig.m_DataObject)
49-
{}
46+
DataObjectError::DataObjectError(const DataObjectError & orig) noexcept = default;
5047

5148
DataObjectError &
5249
DataObjectError::operator=(const DataObjectError &) noexcept = default;

Modules/Core/Common/src/itkImageRegionSplitterDirection.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
namespace itk
2323
{
2424

25-
ImageRegionSplitterDirection::ImageRegionSplitterDirection() {}
25+
ImageRegionSplitterDirection::ImageRegionSplitterDirection() = default;
2626

2727
void
2828
ImageRegionSplitterDirection::PrintSelf(std::ostream & os, Indent indent) const

Modules/Core/Common/src/itkLightProcessObject.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace itk
2222
/**
2323
* Instantiate object with no start, end, or progress methods.
2424
*/
25-
LightProcessObject::LightProcessObject() {}
25+
LightProcessObject::LightProcessObject() = default;
2626

2727
/**
2828
* Destructor for the LightProcessObject class. We've got to

0 commit comments

Comments
 (0)