added typecasting for vectors

This commit is contained in:
2026-04-26 02:14:14 +03:00
parent 3e6b0e7180
commit 580f39210e
6 changed files with 219 additions and 0 deletions
+6
View File
@@ -26,6 +26,12 @@ namespace omath
// Constructors
constexpr Vector2() = default;
template<class CastedType>
requires std::is_arithmetic_v<CastedType>
[[nodiscard]] constexpr explicit operator Vector2<CastedType>() const noexcept
{
return {static_cast<CastedType>(x), static_cast<CastedType>(y)};
}
constexpr Vector2(const Type& x, const Type& y) noexcept: x(x), y(y)
{
}