Skip to content

Commit

Permalink
STYLE: Prefer = delete to explicitly trivial implementations
Browse files Browse the repository at this point in the history
This check replaces undefined special member functions with
= delete;. The explicitly deleted function declarations enable more
opportunities in optimization, because the compiler might treat
explicitly delted functions as noops.

Additionally, the C++11 use of = delete more clearly expreses the
intent for the special member functions.
  • Loading branch information
hjmjohnson committed Feb 20, 2020
1 parent 240751a commit c0f987e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Modules/Bridge/VtkGlue/include/vtkCaptureScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ class vtkCaptureScreen
}

private:
vtkCaptureScreen(const vtkCaptureScreen &);
vtkCaptureScreen(const vtkCaptureScreen &) = delete;
void
operator=(const vtkCaptureScreen &);
operator=(const vtkCaptureScreen &) = delete;

vtkRenderWindow * m_Renderer{ nullptr };

Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/GPUCommon/include/itkGPUImageOps.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class GPUImageOps
itkGetOpenCLSourceFromKernelMacro(GPUImageOpsKernel);

private:
GPUImageOps();
virtual ~GPUImageOps();
GPUImageOps() = delete;
virtual ~GPUImageOps() = delete;
};


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,9 @@ class ConstrainedRegionBasedLevelSetFunctionSharedData
~ConstrainedRegionBasedLevelSetFunctionSharedData() override = default;

private:
ConstrainedRegionBasedLevelSetFunctionSharedData(const Self &); // purposely
// not
// implemented
ConstrainedRegionBasedLevelSetFunctionSharedData(const Self &) = delete;
void
operator=(const Self &); // purposely
// not
// implemented
operator=(const Self &) = delete;
};
} // end namespace itk

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,9 @@ class UnconstrainedRegionBasedLevelSetFunctionSharedData
~UnconstrainedRegionBasedLevelSetFunctionSharedData() override = default;

private:
UnconstrainedRegionBasedLevelSetFunctionSharedData(const Self &); // purposely
// not
// implemented
UnconstrainedRegionBasedLevelSetFunctionSharedData(const Self &) = delete;
void
operator=(const Self &); // purposely
// not
// implemented
operator=(const Self &) = delete;
};
} // end namespace itk

Expand Down
4 changes: 2 additions & 2 deletions Modules/Numerics/FEM/include/itkFEMLinearSystemWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -532,11 +532,11 @@ class ITKFEM_EXPORT LinearSystemWrapper : public Solution
unsigned int matrixIndex = 0);

/** Copy constructor is not allowed. */
LinearSystemWrapper(const LinearSystemWrapper &);
LinearSystemWrapper(const LinearSystemWrapper &) = delete;

/** Asignment operator is not allowed. */
const LinearSystemWrapper &
operator=(const LinearSystemWrapper &);
operator=(const LinearSystemWrapper &) = delete;
};

class ITK_ABI_EXPORT FEMExceptionLinearSystem : public FEMException
Expand Down

0 comments on commit c0f987e

Please sign in to comment.