Skip to content

Commit

Permalink
STYLE: Let Point, RGBPixel, RGBAPixel operator== just call the BaseArray
Browse files Browse the repository at this point in the history
Similar to the implementation of `Vector::operator==`.
  • Loading branch information
N-Dekker authored and hjmjohnson committed Mar 1, 2024
1 parent 613c8f4 commit 28f84ab
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 23 deletions.
8 changes: 1 addition & 7 deletions Modules/Core/Common/include/itkPoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,7 @@ class ITK_TEMPLATE_EXPORT Point : public FixedArray<TCoordRep, VPointDimension>
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);
Expand Down
9 changes: 1 addition & 8 deletions Modules/Core/Common/include/itkRGBAPixel.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,7 @@ template <typename T>
bool
RGBAPixel<T>::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 <typename T>
Expand Down
9 changes: 1 addition & 8 deletions Modules/Core/Common/include/itkRGBPixel.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,7 @@ template <typename T>
bool
RGBPixel<T>::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 <typename T>
Expand Down

0 comments on commit 28f84ab

Please sign in to comment.