diff --git a/include/omath/Vector2.hpp b/include/omath/Vector2.hpp index 5873eb7..f2ae0c3 100644 --- a/include/omath/Vector2.hpp +++ b/include/omath/Vector2.hpp @@ -7,7 +7,7 @@ #include #ifdef OMATH_IMGUI_INTEGRATION - class ImVec2; +#include #endif @@ -159,17 +159,6 @@ namespace omath return *this; } - template - [[nodiscard]] constexpr const type& As() const - { - return *reinterpret_cast(this); - } - template - [[nodiscard]] constexpr type& As() - { - return *reinterpret_cast(this); - } - [[nodiscard]] constexpr Vector2 operator-() const { return {-x, -y}; @@ -210,15 +199,9 @@ namespace omath #ifdef OMATH_IMGUI_INTEGRATION [[nodiscard]] - const ImVec2& ToImVec2() const + ImVec2 ToImVec2() const { - return *reinterpret_cast(this); - } - - [[nodiscard]] - ImVec2& ToImVec2() - { - return *reinterpret_cast(this); + return {static_cast(this->x), static_cast(this->y)}; } #endif }; diff --git a/include/omath/Vector4.hpp b/include/omath/Vector4.hpp index f927445..258cf73 100644 --- a/include/omath/Vector4.hpp +++ b/include/omath/Vector4.hpp @@ -6,9 +6,6 @@ #include #include -#ifdef OMATH_IMGUI_INTEGRATION - class ImVec4; -#endif namespace omath { @@ -161,15 +158,15 @@ namespace omath #ifdef OMATH_IMGUI_INTEGRATION [[nodiscard]] - constexpr ImVec4& ToImVec4() const + ImVec4 ToImVec4() const { - return *reinterpret_cast(this); - } - - [[nodiscard]] - constexpr ImVec2& ToImVec2() - { - return *reinterpret_cast(this); + return + { + static_cast(this->x), + static_cast(this->y), + static_cast(this->z), + static_cast(w), + }; } #endif };