diff --git a/Userland/Libraries/LibGfx/Line.h b/Userland/Libraries/LibGfx/Line.h index a4b07f23f5..3697eb0a59 100644 --- a/Userland/Libraries/LibGfx/Line.h +++ b/Userland/Libraries/LibGfx/Line.h @@ -134,6 +134,13 @@ public: void set_a(Point const& a) { m_a = a; } void set_b(Point const& b) { m_b = b; } + template + requires(!IsSame) + [[nodiscard]] ALWAYS_INLINE constexpr Line to_type() const + { + return Line(*this); + } + String to_string() const; private: diff --git a/Userland/Libraries/LibGfx/Point.h b/Userland/Libraries/LibGfx/Point.h index 9ef99607fc..ce9fba7c28 100644 --- a/Userland/Libraries/LibGfx/Point.h +++ b/Userland/Libraries/LibGfx/Point.h @@ -229,7 +229,8 @@ public: [[nodiscard]] Point end_point_for_aspect_ratio(Point const& previous_end_point, float aspect_ratio) const; template - [[nodiscard]] Point to_type() const + requires(!IsSame) + [[nodiscard]] Point to_type() const { return Point(*this); } diff --git a/Userland/Libraries/LibGfx/Rect.h b/Userland/Libraries/LibGfx/Rect.h index 493fe2fa03..99e6566913 100644 --- a/Userland/Libraries/LibGfx/Rect.h +++ b/Userland/Libraries/LibGfx/Rect.h @@ -949,7 +949,8 @@ public: } template - [[nodiscard]] ALWAYS_INLINE Rect to_type() const + requires(!IsSame) + [[nodiscard]] ALWAYS_INLINE Rect to_type() const { return Rect(*this); } diff --git a/Userland/Libraries/LibGfx/Size.h b/Userland/Libraries/LibGfx/Size.h index 16f3a623e6..6e5931432c 100644 --- a/Userland/Libraries/LibGfx/Size.h +++ b/Userland/Libraries/LibGfx/Size.h @@ -176,7 +176,8 @@ public: } template - [[nodiscard]] ALWAYS_INLINE constexpr Size to_type() const + requires(!IsSame) + [[nodiscard]] ALWAYS_INLINE constexpr Size to_type() const { return Size(*this); }