Skip to content

Commit

Permalink
Rename Rect comparison operands to avoid confusion
Browse files Browse the repository at this point in the history
  • Loading branch information
kimci86 committed May 20, 2024
1 parent dc1e0dc commit 1e857d0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions include/SFML/Graphics/Rect.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,29 +125,29 @@ class Rect
///
/// 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
/// \brief Overload of binary operator !=
///
/// 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>;
Expand Down
8 changes: 4 additions & 4 deletions include/SFML/Graphics/Rect.inl
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 1e857d0

Please sign in to comment.