mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 17:17:45 +00:00
LibGfx: Prevent calling to_type<T>()
on Line/Point/Rect/Size<T>
Also, add `Line::to_type<T>()` since that was missing. Calling to_type() with the same type as the existing object accomplishes nothing except wasting some cycles and making the code more verbose, and it is hard to spot. Nobody does this in the code currently (yay!) but I made this mistake repeatedly when doing my step-by-step CSS Pixels conversion, so let's make it easier to catch them.
This commit is contained in:
parent
34fd5cb206
commit
234bc0c237
4 changed files with 13 additions and 3 deletions
|
@ -229,7 +229,8 @@ public:
|
|||
[[nodiscard]] Point end_point_for_aspect_ratio(Point const& previous_end_point, float aspect_ratio) const;
|
||||
|
||||
template<typename U>
|
||||
[[nodiscard]] Point<U> to_type() const
|
||||
requires(!IsSame<T, U>)
|
||||
[[nodiscard]] Point<U> to_type() const
|
||||
{
|
||||
return Point<U>(*this);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue