COMP: Support non-EqualityComparable pixels Image template instantiation#2585
Conversation
|
Nice. Do we want the template to include a |
Nice suggestion @Leengit I think I would rather have a compilation error on |
dzenanz
left a comment
There was a problem hiding this comment.
If it compiles and works as intended, good.
I must say, that Linux-warning is non-ObVious 😸 to me: https://open.cdash.org/viewBuildError.php?type=1&buildid=7271820
Any suggestion? |
Sadly, no. It is just as cryptic to me. |
b432b7a to
4549ea3
Compare
|
@dzenanz Just fixed the Linux GCC warning, which said:
The fix (as I just force-pushed) was to simply use the function, en another unit test! 😄 |
Leengit
left a comment
There was a problem hiding this comment.
In itkImage.h, is this line correct?:
const TPixel * const lhsBufferPointer = lhsBuffer.GetBufferPointer();I worry that TPixel is the pixel type of the right-hand side, but not necessarily of the left-hand side.
Well observed @Leengit Would you like it better if it would use Please keep in mind that the aim of this pull request is just to allow |
So that the compiler catches type errors for me, I usually use the actual type if I can determine it and if it isn't completely obvious -- e.g., because we just cast to it on the right-hand side. In this case, I believe that that would be |
OK @Leengit If I amend the commit to use |
It's a deal. |
4549ea3 to
b02c9cf
Compare
@Leengit Thanks! Please check the amend + force-push: https://github.com/InsightSoftwareConsortium/ITK/compare/4549ea34b6f124cce48c6dcf7ba33aea9476e4b9..b02c9cfdb9788cbd02388f3579e26903a1654f52 Hope you appreciate the |
The Is the thinking that the |
Indeed 😃
Yes, exactly. The static_assert may be removed once (if ever) we need |
|
Update: force-pushed, now using C++ SFINAE ( |
The ability to instantiate `itk::Image<TPixel, VImageDimension>` for a non-EqualityComparable pixel type was broken by: "ENH: Add operator== and operator!= to itk::Image" pull request InsightSoftwareConsortium#2188 commit 7f3337d Reported by Bradley Lowekamp: issue InsightSoftwareConsortium#2583 "Explicit instantiation of itk::Image fails with 5.2 when pixel type does not support operator==" This commit fixes the issue by defining the `operator==` and `operator!=` friend functions of `itk::Image` as function _templates_, rather than as non-templates.
b02c9cf to
2e9f9ad
Compare
blowekamp
left a comment
There was a problem hiding this comment.
Thanks for addressing the reported issue 👍
The ability to instantiate
itk::Image<TPixel, VImageDimension>for anon-EqualityComparable pixel type was broken by:
"ENH: Add operator== and operator!= to itk::Image"
pull request #2188
commit 7f3337d
Reported by Bradley Lowekamp:
issue #2583
"Explicit instantiation of itk::Image fails with 5.2 when pixel type
does not support operator=="
This commit fixes the issue by defining the
operator==andoperator!=friend functions of
itk::Imageas function templates, rather than asnon-templates.