Skip to content

Commit dd42472

Browse files
committed
COMP: Prefer brace initialization
Since C++11, the brace form {} is preferred in most cases because it provides safer, more consistent, and less surprising behavior. {} (brace initialization) disallows implicit conversions that lose information.
1 parent 3279b33 commit dd42472

File tree

1,466 files changed

+3998
-4000
lines changed

Some content is hidden

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

1,466 files changed

+3998
-4000
lines changed

Modules/Bridge/NumPy/include/itkPyBuffer.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ PyBuffer<TImage>::_get_image_view_from_contiguous_array(PyObject * arr, PyObject
112112
using InternalPixelType = typename TImage::InternalPixelType;
113113
using ImporterType = ImportImageContainer<SizeValueType, InternalPixelType>;
114114
auto importer = ImporterType::New();
115-
constexpr bool importImageFilterWillOwnTheBuffer = false;
115+
constexpr bool importImageFilterWillOwnTheBuffer{ false };
116116
auto * const data = static_cast<InternalPixelType *>(buffer);
117117
importer->SetImportPointer(data, numberOfPixels, importImageFilterWillOwnTheBuffer);
118118

Modules/Bridge/VtkGlue/test/itkImageToVTKImageFilterRGBTest.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ itkImageToVTKImageFilterRGBTest(int argc, char * argv[])
3434
}
3535
const char * inputFileName = argv[1];
3636

37-
constexpr unsigned int Dimension = 2;
37+
constexpr unsigned int Dimension{ 2 };
3838
using PixelComponentType = unsigned char;
3939
using PixelType = itk::RGBPixel<PixelComponentType>;
4040
using ImageType = itk::Image<PixelType, Dimension>;

Modules/Bridge/VtkGlue/test/itkImageToVTKImageFilterTest.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
int
2626
itkImageToVTKImageFilterTest(int, char *[])
2727
{
28-
constexpr int dim = 3;
28+
constexpr int dim{ 3 };
2929
using ImageType = itk::Image<float, dim>;
3030
using SourceType = itk::RandomImageSource<ImageType>;
3131
using SpacingType = SourceType::SpacingType;

Modules/Bridge/VtkGlue/test/itkVTKImageToImageFilterTest.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
int
2626
itkVTKImageToImageFilterTest(int, char *[])
2727
{
28-
constexpr int dim = 2;
28+
constexpr int dim{ 2 };
2929
using ImageType = itk::Image<double, dim>;
3030
using VTKNoiseType = vtkSmartPointer<vtkImageNoiseSource>;
3131
using ConnectorType = itk::VTKImageToImageFilter<ImageType>;

Modules/Bridge/VtkGlue/test/runViewImage.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ runViewImage(int argc, char * argv[])
5454
}
5555
const std::string inputImage = argv[1];
5656

57-
constexpr unsigned int dimension = 3;
57+
constexpr unsigned int dimension{ 3 };
5858
using PixelType = float;
5959
using ImageType = itk::Image<PixelType, dimension>;
6060
using ReaderType = itk::ImageFileReader<ImageType>;

Modules/Core/Common/include/itkBresenhamLine.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ BresenhamLine<VDimension>::BuildLine(LType Direction, IdentifierType length) ->
3232

3333
Direction.Normalize();
3434
// we are going to start at 0
35-
constexpr IndexType StartIndex = { { 0 } };
35+
constexpr IndexType StartIndex{ 0 };
3636
IndexType LastIndex;
3737
for (unsigned int i = 0; i < VDimension; ++i)
3838
{

Modules/Core/Common/include/itkDerivativeOperator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace itk
3939
using DerivativeOperatorType = itk::DerivativeOperator<float, 2>;
4040
DerivativeOperatorType derivativeOperator;
4141
derivativeOperator.SetDirection(0); // X dimension
42-
constexpr auto radius = itk::Size<2>::Filled(1); // A radius of 1 in both dimensions is a 3x3 operator
42+
constexpr auto radius{ itk::Size<2>::Filled(1) }; // A radius of 1 in both dimensions is a 3x3 operator
4343
derivativeOperator.CreateToRadius(radius);
4444
\endcode
4545
* and creates a kernel that looks like:

Modules/Core/Common/include/itkGaussianDerivativeOperator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class ITK_TEMPLATE_EXPORT GaussianDerivativeOperator : public NeighborhoodOperat
171171
void
172172
SetMaximumError(const double maxerror)
173173
{
174-
constexpr double Min = 0.00001;
174+
constexpr double Min{ 0.00001 };
175175
const double Max = 1.0 - Min;
176176

177177
m_MaximumError = std::clamp(maxerror, Min, Max);

Modules/Core/Common/include/itkGaussianDerivativeOperator.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ template <typename TPixel, unsigned int VDimension, typename TAllocator>
222222
double
223223
GaussianDerivativeOperator<TPixel, VDimension, TAllocator>::ModifiedBesselI(int n, double y)
224224
{
225-
constexpr double DIGITS = 10.0;
225+
constexpr double DIGITS{ 10.0 };
226226

227227
if (n < 2)
228228
{

Modules/Core/Common/include/itkGaussianOperator.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ template <typename TPixel, unsigned int VDimension, typename TAllocator>
137137
double
138138
GaussianOperator<TPixel, VDimension, TAllocator>::ModifiedBesselI(int n, double y)
139139
{
140-
constexpr double ACCURACY = 40.0;
140+
constexpr double ACCURACY{ 40.0 };
141141

142142
if (n < 2)
143143
{

0 commit comments

Comments
 (0)