Skip to content

Commit

Permalink
COMP: Address HasNumericTraits failure for Vector pixel type.
Browse files Browse the repository at this point in the history
Use default initialization instead of initialization with 0, which
does not work for all numeric pixel type.
  • Loading branch information
blowekamp authored and dzenanz committed May 17, 2023
1 parent a01f9fc commit c9fc138
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkConceptChecking.h
Expand Up @@ -706,7 +706,7 @@ struct HasNumericTraits
Detail::UniqueType<typename NumericTraits<T>::RealType>();
Detail::UniqueType<typename NumericTraits<T>::ScalarRealType>();
Detail::UniqueType<typename NumericTraits<T>::FloatType>();
T a{ 0 };
T a{};

// Test these methods that take an instance of T to
// allow for types with variable length.
Expand Down
9 changes: 9 additions & 0 deletions Modules/Core/Common/test/itkNumericTraitsTest.cxx
Expand Up @@ -1299,5 +1299,14 @@ itkNumericTraitsTest(int, char *[])
// CompileTime Checks IsComplex traits does not return
CheckIsComplexTraits();

itkConceptMacro(NumericTraitsCheckLong, (itk::Concept::HasNumericTraits<long>));
itkConceptMacro(NumericTraitsCheckComplexFloat, (itk::Concept::HasNumericTraits<std::complex<float>>));
itkConceptMacro(NumericTraitsCheckVectorFloat3, (itk::Concept::HasNumericTraits<itk::Vector<float, 3>>));
itkConceptMacro(NumericTraitsCheckStdVectorFloat, (itk::Concept::HasNumericTraits<std::vector<float>>));
itkConceptMacro(NumericTraitsCheckVariableLengthVector,
(itk::Concept::HasNumericTraits<itk::VariableLengthVector<double>>));
itkConceptMacro(NumericTraitsCheckRGBPixel, (itk::Concept::HasNumericTraits<itk::RGBPixel<unsigned char>>));
itkConceptMacro(NumericTraitsCheckRGBAPixel, (itk::Concept::HasNumericTraits<itk::RGBAPixel<unsigned char>>));

return (testPassedStatus) ? EXIT_SUCCESS : EXIT_FAILURE;
}

0 comments on commit c9fc138

Please sign in to comment.