From 38666461c4ce96101c70d4d223a5fc2508861d1c Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Mon, 17 Feb 2020 11:40:58 -0600 Subject: [PATCH] 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. --- applications/rtkprojectionmatrix/rtkprojectionmatrix.cxx | 4 ++-- include/rtkConjugateGradientOperator.hxx | 2 +- include/rtkConstantImageSource.hxx | 2 +- include/rtkCyclicDeformationImageFilter.h | 2 +- include/rtkDPExtractShroudSignalImageFilter.hxx | 2 +- include/rtkDaubechiesWaveletsConvolutionImageFilter.hxx | 2 +- include/rtkDeconstructImageFilter.hxx | 2 +- .../rtkDisplacedDetectorForOffsetFieldOfViewImageFilter.hxx | 2 +- include/rtkDisplacedDetectorImageFilter.hxx | 2 +- include/rtkDrawConvexImageFilter.hxx | 2 +- include/rtkFDKWarpBackProjectionImageFilter.hxx | 2 +- include/rtkFFTRampImageFilter.hxx | 2 +- include/rtkFieldOfViewImageFilter.hxx | 2 +- include/rtkJosephBackProjectionImageFilter.hxx | 2 +- include/rtkMultiplyByVectorImageFilter.hxx | 2 +- include/rtkNesterovUpdateImageFilter.hxx | 2 +- include/rtkOraLookupTableImageFilter.h | 2 +- include/rtkPhaseReader.hxx | 2 +- include/rtkPolynomialGainCorrectionImageFilter.hxx | 2 +- include/rtkRayQuadricIntersectionImageFilter.hxx | 2 +- include/rtkReconstructImageFilter.hxx | 2 +- include/rtkReg1DExtractShroudSignalImageFilter.hxx | 2 +- include/rtkSelectOneProjectionPerCycleImageFilter.hxx | 2 +- include/rtkVarianObiRawImageFilter.hxx | 2 +- include/rtkZengBackProjectionImageFilter.h | 2 +- include/rtkZengForwardProjectionImageFilter.h | 2 +- src/rtkConvexShape.cxx | 2 +- src/rtkDigisensGeometryReader.cxx | 2 +- src/rtkIntersectionOfConvexShapes.cxx | 2 +- src/rtkQuadricShape.cxx | 2 +- src/rtkReg23ProjectionGeometry.cxx | 2 +- src/rtkThreeDCircularProjectionGeometry.cxx | 2 +- src/rtkWatcherForResourceProbe.cxx | 2 +- test/rtkargsinfomanagertest.cxx | 2 +- 34 files changed, 35 insertions(+), 35 deletions(-) diff --git a/applications/rtkprojectionmatrix/rtkprojectionmatrix.cxx b/applications/rtkprojectionmatrix/rtkprojectionmatrix.cxx index 8e489129e..c3188764f 100644 --- a/applications/rtkprojectionmatrix/rtkprojectionmatrix.cxx +++ b/applications/rtkprojectionmatrix/rtkprojectionmatrix.cxx @@ -34,8 +34,8 @@ template class StoreSparseMatrixSplatWeightMultiplication { public: - StoreSparseMatrixSplatWeightMultiplication(){}; - ~StoreSparseMatrixSplatWeightMultiplication(){}; + StoreSparseMatrixSplatWeightMultiplication()= default;; + ~StoreSparseMatrixSplatWeightMultiplication()= default;; bool operator!=(const StoreSparseMatrixSplatWeightMultiplication &) const { diff --git a/include/rtkConjugateGradientOperator.hxx b/include/rtkConjugateGradientOperator.hxx index 737a0631a..287c983ac 100644 --- a/include/rtkConjugateGradientOperator.hxx +++ b/include/rtkConjugateGradientOperator.hxx @@ -26,7 +26,7 @@ namespace rtk template ConjugateGradientOperator::ConjugateGradientOperator() -{} += default; template void diff --git a/include/rtkConstantImageSource.hxx b/include/rtkConstantImageSource.hxx index 69ecaee42..581d27064 100644 --- a/include/rtkConstantImageSource.hxx +++ b/include/rtkConstantImageSource.hxx @@ -45,7 +45,7 @@ ConstantImageSource::ConstantImageSource() template ConstantImageSource::~ConstantImageSource() -{} += default; template void diff --git a/include/rtkCyclicDeformationImageFilter.h b/include/rtkCyclicDeformationImageFilter.h index 7fab9b64f..1ddfe40ad 100644 --- a/include/rtkCyclicDeformationImageFilter.h +++ b/include/rtkCyclicDeformationImageFilter.h @@ -81,7 +81,7 @@ class ITK_EXPORT CyclicDeformationImageFilter : public itk::ImageToImageFilter DPExtractShroudSignalImageFilter::DPExtractShroudSignalImageFilter() -{} += default; template void diff --git a/include/rtkDaubechiesWaveletsConvolutionImageFilter.hxx b/include/rtkDaubechiesWaveletsConvolutionImageFilter.hxx index 6f970229d..aaa8d5de4 100644 --- a/include/rtkDaubechiesWaveletsConvolutionImageFilter.hxx +++ b/include/rtkDaubechiesWaveletsConvolutionImageFilter.hxx @@ -37,7 +37,7 @@ DaubechiesWaveletsConvolutionImageFilter::DaubechiesWaveletsConvolutionI template DaubechiesWaveletsConvolutionImageFilter::~DaubechiesWaveletsConvolutionImageFilter() -{} += default; template void diff --git a/include/rtkDeconstructImageFilter.hxx b/include/rtkDeconstructImageFilter.hxx index 23658d107..1d899da82 100644 --- a/include/rtkDeconstructImageFilter.hxx +++ b/include/rtkDeconstructImageFilter.hxx @@ -28,7 +28,7 @@ namespace rtk // Default Constructor template DeconstructImageFilter::DeconstructImageFilter() -{} += default; ///////////////////////////////////////////////////////// // PrintSelf() diff --git a/include/rtkDisplacedDetectorForOffsetFieldOfViewImageFilter.hxx b/include/rtkDisplacedDetectorForOffsetFieldOfViewImageFilter.hxx index be789b98d..54eb9c164 100644 --- a/include/rtkDisplacedDetectorForOffsetFieldOfViewImageFilter.hxx +++ b/include/rtkDisplacedDetectorForOffsetFieldOfViewImageFilter.hxx @@ -35,7 +35,7 @@ namespace rtk template DisplacedDetectorForOffsetFieldOfViewImageFilter::DisplacedDetectorForOffsetFieldOfViewImageFilter() -{} += default; /** * When the detector is displaced, one needs to zero pad the input data on the diff --git a/include/rtkDisplacedDetectorImageFilter.hxx b/include/rtkDisplacedDetectorImageFilter.hxx index cc59cec3c..eeeef5ea4 100644 --- a/include/rtkDisplacedDetectorImageFilter.hxx +++ b/include/rtkDisplacedDetectorImageFilter.hxx @@ -30,7 +30,7 @@ namespace rtk template DisplacedDetectorImageFilter::DisplacedDetectorImageFilter() -{} += default; template void diff --git a/include/rtkDrawConvexImageFilter.hxx b/include/rtkDrawConvexImageFilter.hxx index ae27b50a4..31b349a61 100644 --- a/include/rtkDrawConvexImageFilter.hxx +++ b/include/rtkDrawConvexImageFilter.hxx @@ -29,7 +29,7 @@ namespace rtk template DrawConvexImageFilter::DrawConvexImageFilter() -{} += default; template void diff --git a/include/rtkFDKWarpBackProjectionImageFilter.hxx b/include/rtkFDKWarpBackProjectionImageFilter.hxx index df6a69b80..2fc7b01a3 100644 --- a/include/rtkFDKWarpBackProjectionImageFilter.hxx +++ b/include/rtkFDKWarpBackProjectionImageFilter.hxx @@ -31,7 +31,7 @@ namespace rtk template FDKWarpBackProjectionImageFilter::FDKWarpBackProjectionImageFilter() -{} += default; template void diff --git a/include/rtkFFTRampImageFilter.hxx b/include/rtkFFTRampImageFilter.hxx index a86c89342..ccd04af44 100644 --- a/include/rtkFFTRampImageFilter.hxx +++ b/include/rtkFFTRampImageFilter.hxx @@ -34,7 +34,7 @@ namespace rtk template FFTRampImageFilter::FFTRampImageFilter() -{} += default; template void diff --git a/include/rtkFieldOfViewImageFilter.hxx b/include/rtkFieldOfViewImageFilter.hxx index 0046701bc..cb210020a 100644 --- a/include/rtkFieldOfViewImageFilter.hxx +++ b/include/rtkFieldOfViewImageFilter.hxx @@ -36,7 +36,7 @@ namespace rtk template FieldOfViewImageFilter::FieldOfViewImageFilter() -{} += default; template bool diff --git a/include/rtkJosephBackProjectionImageFilter.hxx b/include/rtkJosephBackProjectionImageFilter.hxx index 7136b8d96..8cee76018 100644 --- a/include/rtkJosephBackProjectionImageFilter.hxx +++ b/include/rtkJosephBackProjectionImageFilter.hxx @@ -44,7 +44,7 @@ JosephBackProjectionImageFilter::JosephBackProjectionImageFilter() -{} += default; template MultiplyByVectorImageFilter::MultiplyByVectorImageFilter() -{} += default; template void diff --git a/include/rtkNesterovUpdateImageFilter.hxx b/include/rtkNesterovUpdateImageFilter.hxx index 6a3ab7d10..1f7343265 100644 --- a/include/rtkNesterovUpdateImageFilter.hxx +++ b/include/rtkNesterovUpdateImageFilter.hxx @@ -38,7 +38,7 @@ NesterovUpdateImageFilter::NesterovUpdateImageFilter() template NesterovUpdateImageFilter::~NesterovUpdateImageFilter() -{} += default; template void diff --git a/include/rtkOraLookupTableImageFilter.h b/include/rtkOraLookupTableImageFilter.h index 8c7af883b..d4e129ad2 100644 --- a/include/rtkOraLookupTableImageFilter.h +++ b/include/rtkOraLookupTableImageFilter.h @@ -89,7 +89,7 @@ class ITK_EXPORT OraLookupTableImageFilter } protected: - OraLookupTableImageFilter() {} + OraLookupTableImageFilter() = default; ~OraLookupTableImageFilter() override = default; private: diff --git a/include/rtkPhaseReader.hxx b/include/rtkPhaseReader.hxx index 3d1c98b46..483b7a2aa 100644 --- a/include/rtkPhaseReader.hxx +++ b/include/rtkPhaseReader.hxx @@ -25,7 +25,7 @@ namespace rtk { -PhaseReader::PhaseReader() {} +PhaseReader::PhaseReader() = default; void PhaseReader::PrintSelf(std::ostream & os, itk::Indent indent) const diff --git a/include/rtkPolynomialGainCorrectionImageFilter.hxx b/include/rtkPolynomialGainCorrectionImageFilter.hxx index 2146f53b3..6807d6f15 100644 --- a/include/rtkPolynomialGainCorrectionImageFilter.hxx +++ b/include/rtkPolynomialGainCorrectionImageFilter.hxx @@ -30,7 +30,7 @@ namespace rtk template PolynomialGainCorrectionImageFilter::PolynomialGainCorrectionImageFilter() -{} += default; template void diff --git a/include/rtkRayQuadricIntersectionImageFilter.hxx b/include/rtkRayQuadricIntersectionImageFilter.hxx index 025b2c1cf..37430ee8f 100644 --- a/include/rtkRayQuadricIntersectionImageFilter.hxx +++ b/include/rtkRayQuadricIntersectionImageFilter.hxx @@ -31,7 +31,7 @@ namespace rtk template RayQuadricIntersectionImageFilter::RayQuadricIntersectionImageFilter() -{} += default; template void diff --git a/include/rtkReconstructImageFilter.hxx b/include/rtkReconstructImageFilter.hxx index 9cf22a4e6..dd190be8d 100644 --- a/include/rtkReconstructImageFilter.hxx +++ b/include/rtkReconstructImageFilter.hxx @@ -29,7 +29,7 @@ namespace rtk // Default Constructor template ReconstructImageFilter::ReconstructImageFilter() -{} += default; ///////////////////////////////////////////////////////// diff --git a/include/rtkReg1DExtractShroudSignalImageFilter.hxx b/include/rtkReg1DExtractShroudSignalImageFilter.hxx index a9207800a..a6c31f4f7 100644 --- a/include/rtkReg1DExtractShroudSignalImageFilter.hxx +++ b/include/rtkReg1DExtractShroudSignalImageFilter.hxx @@ -34,7 +34,7 @@ namespace rtk template Reg1DExtractShroudSignalImageFilter::Reg1DExtractShroudSignalImageFilter() -{} += default; template void diff --git a/include/rtkSelectOneProjectionPerCycleImageFilter.hxx b/include/rtkSelectOneProjectionPerCycleImageFilter.hxx index af12b34d8..3575fe38b 100644 --- a/include/rtkSelectOneProjectionPerCycleImageFilter.hxx +++ b/include/rtkSelectOneProjectionPerCycleImageFilter.hxx @@ -26,7 +26,7 @@ namespace rtk template SelectOneProjectionPerCycleImageFilter::SelectOneProjectionPerCycleImageFilter() -{} += default; template void diff --git a/include/rtkVarianObiRawImageFilter.hxx b/include/rtkVarianObiRawImageFilter.hxx index 32c4be510..ee190e23a 100644 --- a/include/rtkVarianObiRawImageFilter.hxx +++ b/include/rtkVarianObiRawImageFilter.hxx @@ -27,7 +27,7 @@ namespace rtk template VarianObiRawImageFilter::VarianObiRawImageFilter() -{} += default; template void diff --git a/include/rtkZengBackProjectionImageFilter.h b/include/rtkZengBackProjectionImageFilter.h index 438228286..05960985e 100644 --- a/include/rtkZengBackProjectionImageFilter.h +++ b/include/rtkZengBackProjectionImageFilter.h @@ -123,7 +123,7 @@ class ITK_EXPORT ZengBackProjectionImageFilter : public BackProjectionImageFilte protected: ZengBackProjectionImageFilter(); - ~ZengBackProjectionImageFilter() ITK_OVERRIDE {} + ~ZengBackProjectionImageFilter() ITK_OVERRIDE = default; /** Apply changes to the input image requested region. */ void diff --git a/include/rtkZengForwardProjectionImageFilter.h b/include/rtkZengForwardProjectionImageFilter.h index 0503f3871..e97b039d5 100644 --- a/include/rtkZengForwardProjectionImageFilter.h +++ b/include/rtkZengForwardProjectionImageFilter.h @@ -115,7 +115,7 @@ class ITK_EXPORT ZengForwardProjectionImageFilter : public ForwardProjectionImag protected: ZengForwardProjectionImageFilter(); - ~ZengForwardProjectionImageFilter() ITK_OVERRIDE {} + ~ZengForwardProjectionImageFilter() ITK_OVERRIDE = default; void GenerateInputRequestedRegion() ITK_OVERRIDE; diff --git a/src/rtkConvexShape.cxx b/src/rtkConvexShape.cxx index bbc3fa2ab..a912920e4 100644 --- a/src/rtkConvexShape.cxx +++ b/src/rtkConvexShape.cxx @@ -21,7 +21,7 @@ namespace rtk { -ConvexShape ::ConvexShape() {} +ConvexShape ::ConvexShape() = default; bool ConvexShape ::IsInside(const PointType & /*point*/) const diff --git a/src/rtkDigisensGeometryReader.cxx b/src/rtkDigisensGeometryReader.cxx index b0d598430..5cd352f78 100644 --- a/src/rtkDigisensGeometryReader.cxx +++ b/src/rtkDigisensGeometryReader.cxx @@ -23,7 +23,7 @@ #include #include -rtk::DigisensGeometryReader ::DigisensGeometryReader() {} +rtk::DigisensGeometryReader ::DigisensGeometryReader() = default; void rtk::DigisensGeometryReader ::GenerateData() diff --git a/src/rtkIntersectionOfConvexShapes.cxx b/src/rtkIntersectionOfConvexShapes.cxx index 71fbe59bd..f7fc51d3d 100644 --- a/src/rtkIntersectionOfConvexShapes.cxx +++ b/src/rtkIntersectionOfConvexShapes.cxx @@ -23,7 +23,7 @@ namespace rtk { -IntersectionOfConvexShapes ::IntersectionOfConvexShapes() {} +IntersectionOfConvexShapes ::IntersectionOfConvexShapes() = default; void IntersectionOfConvexShapes ::SetConvexShapes(const ConvexShapeVector & _arg) diff --git a/src/rtkQuadricShape.cxx b/src/rtkQuadricShape.cxx index 5e886b9ae..2d6a54276 100644 --- a/src/rtkQuadricShape.cxx +++ b/src/rtkQuadricShape.cxx @@ -21,7 +21,7 @@ namespace rtk { -QuadricShape ::QuadricShape() {} +QuadricShape ::QuadricShape() = default; bool QuadricShape ::IsInside(const PointType & point) const diff --git a/src/rtkReg23ProjectionGeometry.cxx b/src/rtkReg23ProjectionGeometry.cxx index b528127ee..9721cd9bc 100644 --- a/src/rtkReg23ProjectionGeometry.cxx +++ b/src/rtkReg23ProjectionGeometry.cxx @@ -22,7 +22,7 @@ rtk::Reg23ProjectionGeometry::Reg23ProjectionGeometry() : rtk::ThreeDCircularProjectionGeometry() {} -rtk::Reg23ProjectionGeometry::~Reg23ProjectionGeometry() {} +rtk::Reg23ProjectionGeometry::~Reg23ProjectionGeometry() = default; bool rtk::Reg23ProjectionGeometry::AddReg23Projection(const PointType & sourcePosition, diff --git a/src/rtkThreeDCircularProjectionGeometry.cxx b/src/rtkThreeDCircularProjectionGeometry.cxx index 909dabec9..101c1169f 100644 --- a/src/rtkThreeDCircularProjectionGeometry.cxx +++ b/src/rtkThreeDCircularProjectionGeometry.cxx @@ -27,7 +27,7 @@ #include #include -rtk::ThreeDCircularProjectionGeometry::ThreeDCircularProjectionGeometry() {} +rtk::ThreeDCircularProjectionGeometry::ThreeDCircularProjectionGeometry() = default; double rtk::ThreeDCircularProjectionGeometry::ConvertAngleBetween0And360Degrees(const double a) diff --git a/src/rtkWatcherForResourceProbe.cxx b/src/rtkWatcherForResourceProbe.cxx index 3dd0cacc0..eb49a6fb4 100644 --- a/src/rtkWatcherForResourceProbe.cxx +++ b/src/rtkWatcherForResourceProbe.cxx @@ -165,6 +165,6 @@ WatcherForResourceProbe ::operator=(const WatcherForResourceProbe & watch) return *this; } -WatcherForResourceProbe ::~WatcherForResourceProbe() {} +WatcherForResourceProbe ::~WatcherForResourceProbe() = default; } // namespace rtk diff --git a/test/rtkargsinfomanagertest.cxx b/test/rtkargsinfomanagertest.cxx index 9fd37290c..267bdfe4f 100644 --- a/test/rtkargsinfomanagertest.cxx +++ b/test/rtkargsinfomanagertest.cxx @@ -7,7 +7,7 @@ class args_info_test public: int testVar{ true }; int verbose_flag{ 0 }; - args_info_test() {} + args_info_test() = default; }; class cleanup_functor