mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 18:07:34 +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
|
@ -176,7 +176,8 @@ public:
|
|||
}
|
||||
|
||||
template<typename U>
|
||||
[[nodiscard]] ALWAYS_INLINE constexpr Size<U> to_type() const
|
||||
requires(!IsSame<T, U>)
|
||||
[[nodiscard]] ALWAYS_INLINE constexpr Size<U> to_type() const
|
||||
{
|
||||
return Size<U>(*this);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue