Concept Checking Is Floating Point#

Synopsis#

Check at compilation time that a given type is floating point.

Results#

Code#

C++#

#include "itkImage.h"
#include "itkConceptChecking.h"

template <typename TImage>
void
IsPixelTypeFloatingPoint(const TImage * const)
{
  itkConceptMacro(nameOfCheck, (itk::Concept::IsFloatingPoint<typename TImage::PixelType>));
}

int
main()
{
  constexpr unsigned int Dimension = 2;
  using FloatImageType = itk::Image<float, Dimension>;
  auto f = FloatImageType::New();
  IsPixelTypeFloatingPoint(f.GetPointer());

  using DoubleImageType = itk::Image<double, Dimension>;
  auto d = DoubleImageType::New();
  IsPixelTypeFloatingPoint(d.GetPointer());

  return EXIT_SUCCESS;
}