Skip to content

Commit d24773c

Browse files
committed
STYLE: Prefer constexpr for const numeric literals
Use constexpr for constant numeric literals.
1 parent b74cc5f commit d24773c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

examples/example.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
int example_gradientdescent( int argc, char* argv[] )
2121
{
2222
// Typedefs
23-
const unsigned int Dimension = 2;
23+
constexpr unsigned int Dimension = 2;
2424
using PixelType = float;
2525
using OutputPixelType = unsigned char;
2626
using ImageType = itk::Image< PixelType, Dimension >;
@@ -124,7 +124,7 @@ return EXIT_SUCCESS;
124124
int example_regularstepgradientdescent( int argc, char* argv[] )
125125
{
126126
// Typedefs
127-
const unsigned int Dimension = 2;
127+
constexpr unsigned int Dimension = 2;
128128
using PixelType = float;
129129
using OutputPixelType = unsigned char;
130130
using ImageType = itk::Image< PixelType, Dimension >;

include/itkSingleImageCostFunction.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ SingleImageCostFunction<TImage>
137137
}
138138

139139
// Convert the image function output to the cost function derivative
140-
const typename DerivativeType::ValueType DerivativeThreshold = 15.0;
140+
constexpr typename DerivativeType::ValueType DerivativeThreshold = 15.0;
141141
for (unsigned int i=0; i<ImageDimension; i++)
142142
{
143143
derivative[i] = static_cast<typename DerivativeType::ValueType>( output[i] );

0 commit comments

Comments
 (0)