Rename Rect comparison operands to avoid confusion

This commit is contained in:
kimci86 2024-05-04 22:28:08 +02:00 committed by Vittorio Romeo
parent 58e83056bb
commit f96bf1f300
2 changed files with 12 additions and 12 deletions

View File

@ -125,14 +125,14 @@ public:
///
/// This operator compares strict equality between two rectangles.
///
/// \param left Left operand (a rectangle)
/// \param right Right operand (a rectangle)
/// \param lhs Left operand (a rectangle)
/// \param rhs Right operand (a rectangle)
///
/// \return True if \a left is equal to \a right
/// \return True if \a lhs is equal to \a rhs
///
////////////////////////////////////////////////////////////
template <typename T>
[[nodiscard]] constexpr bool operator==(const Rect<T>& left, const Rect<T>& right);
[[nodiscard]] constexpr bool operator==(const Rect<T>& lhs, const Rect<T>& rhs);
////////////////////////////////////////////////////////////
/// \relates Rect
@ -140,14 +140,14 @@ template <typename T>
///
/// This operator compares strict difference between two rectangles.
///
/// \param left Left operand (a rectangle)
/// \param right Right operand (a rectangle)
/// \param lhs Left operand (a rectangle)
/// \param rhs Right operand (a rectangle)
///
/// \return True if \a left is not equal to \a right
/// \return True if \a lhs is not equal to \a rhs
///
////////////////////////////////////////////////////////////
template <typename T>
[[nodiscard]] constexpr bool operator!=(const Rect<T>& left, const Rect<T>& right);
[[nodiscard]] constexpr bool operator!=(const Rect<T>& lhs, const Rect<T>& rhs);
// Create type aliases for the most common types
using IntRect = Rect<int>;

View File

@ -120,17 +120,17 @@ constexpr Vector2<T> Rect<T>::getCenter() const
////////////////////////////////////////////////////////////
template <typename T>
constexpr bool operator==(const Rect<T>& left, const Rect<T>& right)
constexpr bool operator==(const Rect<T>& lhs, const Rect<T>& rhs)
{
return (left.position == right.position) && (left.size == right.size);
return (lhs.position == rhs.position) && (lhs.size == rhs.size);
}
////////////////////////////////////////////////////////////
template <typename T>
constexpr bool operator!=(const Rect<T>& left, const Rect<T>& right)
constexpr bool operator!=(const Rect<T>& lhs, const Rect<T>& rhs)
{
return !(left == right);
return !(lhs == rhs);
}
} // namespace sf