Skip to content

Commit da13473

Browse files
hjmjohnsonN-Dekker
authored andcommitted
STYLE: Remove IsSigned and replace with std::is_signed
Prefer builtin C++11 language features for identifying signed types. :%s#NumericTraits<\([^>]*\)>::IsSigned#std::is_signed<\1>::value#gc
1 parent b3f80bb commit da13473

13 files changed

+17
-17
lines changed

Modules/Core/Common/include/itkMath.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,9 +516,9 @@ template <typename TInputType1, typename TInputType2>
516516
struct AlmostEqualsScalarImplementer
517517
{
518518
static constexpr bool TInputType1IsInteger = std::is_integral<TInputType1>::value;
519-
static constexpr bool TInputType1IsSigned = itk::NumericTraits<TInputType1>::IsSigned;
519+
static constexpr bool TInputType1IsSigned = std::is_signed<TInputType1>::value;
520520
static constexpr bool TInputType2IsInteger = std::is_integral<TInputType2>::value;
521-
static constexpr bool TInputType2IsSigned = itk::NumericTraits<TInputType2>::IsSigned;
521+
static constexpr bool TInputType2IsSigned = std::is_signed<TInputType2>::value;
522522

523523
using SelectedVersion = typename AlmostEqualsFunctionSelector<TInputType1IsInteger,
524524
TInputType1IsSigned,

Modules/Core/Common/include/itkNumericTraits.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1924,7 +1924,7 @@ class NumericTraits<std::complex<TComponent>>
19241924
return val.real() >= 0;
19251925
}
19261926

1927-
static constexpr bool IsSigned = NumericTraits<ValueType>::IsSigned;
1927+
static constexpr bool IsSigned = std::is_signed<ValueType>::value;
19281928
static constexpr bool IsInteger = false;
19291929
static constexpr bool IsComplex = true;
19301930
static Self

Modules/Core/Common/include/itkNumericTraitsArrayPixel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class NumericTraits<Array<T>>
112112
return b;
113113
}
114114

115-
static constexpr bool IsSigned = NumericTraits<ValueType>::IsSigned;
115+
static constexpr bool IsSigned = std::is_signed<ValueType>::value;
116116
static constexpr bool IsInteger = std::is_integral<ValueType>::value;
117117
static constexpr bool IsComplex = NumericTraits<ValueType>::IsComplex;
118118

Modules/Core/Common/include/itkNumericTraitsCovariantVectorPixel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class NumericTraits<CovariantVector<T, D>>
143143
return OneValue();
144144
}
145145

146-
static constexpr bool IsSigned = NumericTraits<ValueType>::IsSigned;
146+
static constexpr bool IsSigned = std::is_signed<ValueType>::value;
147147
static constexpr bool IsInteger = std::is_integral<ValueType>::value;
148148
static constexpr bool IsComplex = NumericTraits<ValueType>::IsComplex;
149149

Modules/Core/Common/include/itkNumericTraitsDiffusionTensor3DPixel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class NumericTraits<DiffusionTensor3D<T>>
144144
return Self(NumericTraits<T>::OneValue());
145145
}
146146

147-
static constexpr bool IsSigned = NumericTraits<ValueType>::IsSigned;
147+
static constexpr bool IsSigned = std::is_signed<ValueType>::value;
148148
static constexpr bool IsInteger = std::is_integral<ValueType>::value;
149149
static constexpr bool IsComplex = NumericTraits<ValueType>::IsComplex;
150150

Modules/Core/Common/include/itkNumericTraitsPointPixel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ class NumericTraits<Point<T, D>>
130130
return OneValue();
131131
}
132132

133-
static constexpr bool IsSigned = NumericTraits<ValueType>::IsSigned;
133+
static constexpr bool IsSigned = std::is_signed<ValueType>::value;
134134
static constexpr bool IsInteger = std::is_integral<ValueType>::value;
135135
static constexpr bool IsComplex = NumericTraits<ValueType>::IsComplex;
136136

Modules/Core/Common/include/itkNumericTraitsRGBAPixel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ class NumericTraits<RGBAPixel<T>>
170170
return NumericTraits<typename Self::LuminanceType>::IsNonnegative(val.GetLuminance());
171171
}
172172

173-
static constexpr bool IsSigned = NumericTraits<ValueType>::IsSigned;
173+
static constexpr bool IsSigned = std::is_signed<ValueType>::value;
174174
static constexpr bool IsInteger = std::is_integral<ValueType>::value;
175175
static constexpr bool IsComplex = NumericTraits<ValueType>::IsComplex;
176176

Modules/Core/Common/include/itkNumericTraitsRGBPixel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ class NumericTraits<RGBPixel<T>>
170170
return NumericTraits<typename Self::LuminanceType>::IsNonnegative(val.GetLuminance());
171171
}
172172

173-
static constexpr bool IsSigned = NumericTraits<ValueType>::IsSigned;
173+
static constexpr bool IsSigned = std::is_signed<ValueType>::value;
174174
static constexpr bool IsInteger = std::is_integral<ValueType>::value;
175175
static constexpr bool IsComplex = NumericTraits<ValueType>::IsComplex;
176176

Modules/Core/Common/include/itkNumericTraitsStdVector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class NumericTraits<std::vector<T>>
131131
return b;
132132
}
133133

134-
static constexpr bool IsSigned = NumericTraits<ValueType>::IsSigned;
134+
static constexpr bool IsSigned = std::is_signed<ValueType>::value;
135135
static constexpr bool IsInteger = std::is_integral<ValueType>::value;
136136
static constexpr bool IsComplex = NumericTraits<ValueType>::IsComplex;
137137

Modules/Core/Common/include/itkNumericTraitsTensorPixel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class NumericTraits<SymmetricSecondRankTensor<T, D>>
143143
return OneValue();
144144
}
145145

146-
static constexpr bool IsSigned = NumericTraits<ValueType>::IsSigned;
146+
static constexpr bool IsSigned = std::is_signed<ValueType>::value;
147147
static constexpr bool IsInteger = std::is_integral<ValueType>::value;
148148
static constexpr bool IsComplex = NumericTraits<ValueType>::IsComplex;
149149

Modules/Core/Common/include/itkNumericTraitsVariableLengthVectorPixel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ class NumericTraits<VariableLengthVector<T>>
192192
return flag;
193193
}
194194

195-
static constexpr bool IsSigned = NumericTraits<ValueType>::IsSigned;
195+
static constexpr bool IsSigned = std::is_signed<ValueType>::value;
196196
static constexpr bool IsInteger = std::is_integral<ValueType>::value;
197197
static constexpr bool IsComplex = NumericTraits<ValueType>::IsComplex;
198198

Modules/Core/Common/include/itkNumericTraitsVectorPixel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ class NumericTraits<Vector<T, D>>
185185
return flag;
186186
}
187187

188-
static constexpr bool IsSigned = NumericTraits<ValueType>::IsSigned;
188+
static constexpr bool IsSigned = std::is_signed<ValueType>::value;
189189
static constexpr bool IsInteger = std::is_integral<ValueType>::value;
190190
static constexpr bool IsComplex = NumericTraits<ValueType>::IsComplex;
191191

Modules/Core/Common/test/itkNumericTraitsTest.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,17 +210,17 @@ CheckSignedAndIntegerTraitsSameAsSTDNumericLimits(const char * const name)
210210
std::cout << "\tERROR: IsSigned definitions for itk::NumericTraits and std::numeric_limits do not match!! ERROR!!"
211211
<< std::endl;
212212
std::cout << "\tFor type: \t" << name << std::endl;
213-
std::cout << "\tITK signed Value for:\t< " << name << " >\tis:\t"
214-
<< (itk::NumericTraits<T>::IsSigned ? "true" : "false") << std::endl;
213+
std::cout << "\tITK signed Value for:\t< " << name << " >\tis:\t" << (std::is_signed<T>::value ? "true" : "false")
214+
<< std::endl;
215215
std::cout << "\tstd signed Value for:\t< " << name << " >\tis:\t"
216216
<< (std::numeric_limits<T>::is_signed ? "true" : "false") << std::endl;
217217
didTestPass = false;
218218
}
219219
else
220220
{
221221
std::cout << "\tSUCCESS: IsSigned definition for itk::NumericTraits matches std::numeric_limits" << std::endl;
222-
std::cout << "\tSigned Value for:\t< " << name << " >\tis:\t"
223-
<< (itk::NumericTraits<T>::IsSigned ? "true" : "false") << std::endl;
222+
std::cout << "\tSigned Value for:\t< " << name << " >\tis:\t" << (std::is_signed<T>::value ? "true" : "false")
223+
<< std::endl;
224224
}
225225

226226
// test for IsInteger

0 commit comments

Comments
 (0)