From 28f84ab956d2d4139823026fcf8e6159b0269d2b Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Thu, 29 Feb 2024 19:23:45 +0100 Subject: [PATCH] STYLE: Let Point, RGBPixel, RGBAPixel operator== just call the BaseArray Similar to the implementation of `Vector::operator==`. --- Modules/Core/Common/include/itkPoint.h | 8 +------- Modules/Core/Common/include/itkRGBAPixel.hxx | 9 +-------- Modules/Core/Common/include/itkRGBPixel.hxx | 9 +-------- 3 files changed, 3 insertions(+), 23 deletions(-) diff --git a/Modules/Core/Common/include/itkPoint.h b/Modules/Core/Common/include/itkPoint.h index 2cee491b2f7..acce71b6565 100644 --- a/Modules/Core/Common/include/itkPoint.h +++ b/Modules/Core/Common/include/itkPoint.h @@ -137,13 +137,7 @@ class ITK_TEMPLATE_EXPORT Point : public FixedArray bool operator==(const Self & pt) const { - bool same = true; - - for (unsigned int i = 0; i < VPointDimension && same; ++i) - { - same = (Math::ExactlyEquals((*this)[i], pt[i])); - } - return same; + return this->BaseArray::operator==(pt); } ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(Self); diff --git a/Modules/Core/Common/include/itkRGBAPixel.hxx b/Modules/Core/Common/include/itkRGBAPixel.hxx index 437786f2099..65d5028ec28 100644 --- a/Modules/Core/Common/include/itkRGBAPixel.hxx +++ b/Modules/Core/Common/include/itkRGBAPixel.hxx @@ -131,14 +131,7 @@ template bool RGBAPixel::operator==(const Self & r) const { - for (unsigned int i = 0; i < 4; ++i) - { - if ((*this)[i] != r[i]) - { - return false; - } - } - return true; + return this->BaseArray::operator==(r); } template diff --git a/Modules/Core/Common/include/itkRGBPixel.hxx b/Modules/Core/Common/include/itkRGBPixel.hxx index 38b0f8067c8..e89f6ba17e5 100644 --- a/Modules/Core/Common/include/itkRGBPixel.hxx +++ b/Modules/Core/Common/include/itkRGBPixel.hxx @@ -131,14 +131,7 @@ template bool RGBPixel::operator==(const Self & r) const { - for (unsigned int i = 0; i < 3; ++i) - { - if (Math::NotExactlyEquals((*this)[i], r[i])) - { - return false; - } - } - return true; + return this->BaseArray::operator==(r); } template