Hello,
Recently Apple updated their Clang, which now supports more of the C++20 standard. Due to the changes in how the comparison operator work in C++20 (to support the spaceship operator as I understand it), I am now hitting the following error when compiling:
vcpkg_installed/x64-osx-asan/include/ITK-5.1/itkImageToHistogramFilter.hxx:294:18: error: use of overloaded operator '!=' is ambiguous (with operand types 'HistogramIterator' (aka 'itk::Statistics::Histogram<double, itk::Statistics::DenseFrequencyContainer2>::ConstIterator') and 'HistogramIterator')
while (hit != end)
~~~ ^ ~~~
vcpkg_installed/x64-osx-asan/include/ITK-5.1/itkImageToHistogramFilter.h:144:3: note: in instantiation of member function 'itk::Statistics::ImageToHistogramFilter<itk::Image<float, 3> >::ThreadedMergeHistogram' requested here
ImageToHistogramFilter();
^
vcpkg_installed/x64-osx-asan/include/ITK-5.1/itkImageToHistogramFilter.h:65:15: note: in instantiation of member function 'itk::Statistics::ImageToHistogramFilter<itk::Image<float, 3> >::ImageToHistogramFilter' requested here
itkNewMacro(Self);
^
vcpkg_installed/x64-osx-asan/include/ITK-5.1/itkHistogramThresholdImageFilter.hxx:77:74: note: in instantiation of member function 'itk::Statistics::ImageToHistogramFilter<itk::Image<float, 3> >::New' requested here
HistogramGeneratorPointer histogramGenerator = HistogramGeneratorType::New();
^
vcpkg_installed/x64-osx-asan/include/ITK-5.1/itkOtsuThresholdImageFilter.h:110:3: note: in instantiation of member function 'itk::HistogramThresholdImageFilter<itk::Image<float, 3>, itk::Image<int, 3>, itk::Image<int, 3> >::GenerateData' requested here
OtsuThresholdImageFilter() { this->SetCalculator(CalculatorType::New()); }
^
vcpkg_installed/x64-osx-asan/include/ITK-5.1/itkOtsuThresholdImageFilter.h:68:15: note: in instantiation of member function 'itk::OtsuThresholdImageFilter<itk::Image<float, 3>, itk::Image<int, 3>, itk::Image<int, 3> >::OtsuThresholdImageFilter' requested here
itkNewMacro(Self);
^
../Source/Core/Masking.cpp:41:72: note: in instantiation of member function 'itk::OtsuThresholdImageFilter<itk::Image<float, 3>, itk::Image<int, 3>, itk::Image<int, 3> >::New' requested here
auto otsuFilter = itk::OtsuThresholdImageFilter<VolumeF, VolumeI>::New();
^
vcpkg_installed/x64-osx-asan/include/ITK-5.1/itkHistogram.h:405:5: note: candidate function
operator!=(const ConstIterator & it)
^
vcpkg_installed/x64-osx-asan/include/ITK-5.1/itkHistogram.h:411:5: note: candidate function
operator==(const ConstIterator & it)
^
I thought I would report here before opening an issue as I have a hunch this won’t be the only such problem, and fixing them does not always seem to be straightforward. I’ve also hit the same problem in Eigen. I don’t fully understand why these problems occur, let alone have a solution that is compatible with both C++11 and C++20.
Thanks!