mirror of
https://github.com/orange-cpp/omath.git
synced 2026-06-15 11:44:34 +00:00
added typecasting for vectors
This commit is contained in:
@@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user