1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:57:45 +00:00

LibGfx: Add VectorN::to_type<T>()

This commit is contained in:
Jelle Raaijmakers 2022-05-08 01:54:21 +02:00 committed by Linus Groh
parent dfe002cfd4
commit 878111abf6

View file

@ -224,6 +224,16 @@ public:
return String::formatted("[{},{},{},{}]", x(), y(), z(), w()); return String::formatted("[{},{},{},{}]", x(), y(), z(), w());
} }
template<typename U>
[[nodiscard]] VectorN<N, U> to_type() const
{
VectorN<N, U> result;
UNROLL_LOOP
for (auto i = 0u; i < N; ++i)
result.data()[i] = static_cast<U>(m_data[i]);
return result;
}
template<typename U> template<typename U>
[[nodiscard]] VectorN<N, U> to_rounded() const [[nodiscard]] VectorN<N, U> to_rounded() const
{ {