diff options
author | mjagdis <mjagdis@eris-associates.co.uk> | 2024-11-01 23:18:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-01 23:18:50 +0100 |
commit | 352134ba9e39b8d995ca4657c821915af01c74bc (patch) | |
tree | 8baaaab1450c3e79aefd56d593041fa103a297d8 /src | |
parent | Fix access to uninitialized space (#5576) (diff) | |
download | cuberite-352134ba9e39b8d995ca4657c821915af01c74bc.tar cuberite-352134ba9e39b8d995ca4657c821915af01c74bc.tar.gz cuberite-352134ba9e39b8d995ca4657c821915af01c74bc.tar.bz2 cuberite-352134ba9e39b8d995ca4657c821915af01c74bc.tar.lz cuberite-352134ba9e39b8d995ca4657c821915af01c74bc.tar.xz cuberite-352134ba9e39b8d995ca4657c821915af01c74bc.tar.zst cuberite-352134ba9e39b8d995ca4657c821915af01c74bc.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/Vector3.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Vector3.h b/src/Vector3.h index 0e275e9b3..b48f35786 100644 --- a/src/Vector3.h +++ b/src/Vector3.h @@ -30,13 +30,20 @@ public: // tolua_end // Conversion constructors where U is not the same as T leaving the copy-constructor implicitly generated - template <typename U, typename = typename std::enable_if<!std::is_same<U, T>::value>::type> - constexpr Vector3(const Vector3<U> & a_Rhs): + template <typename U, std::enable_if_t<(!std::is_same<U, T>::value) && ((!std::is_integral<T>::value) || (std::is_integral<U>::value)), bool> = true> + constexpr Vector3<T>(const Vector3<U> & a_Rhs): x(static_cast<T>(a_Rhs.x)), y(static_cast<T>(a_Rhs.y)), z(static_cast<T>(a_Rhs.z)) { } + template <typename U, std::enable_if_t<(!std::is_same<U, T>::value) && ((std::is_integral<T>::value) && (!std::is_integral<U>::value)), bool> = true> + constexpr Vector3<T>(const Vector3<U> & a_Rhs): + x(static_cast<T>(std::floor(a_Rhs.x))), + y(static_cast<T>(std::floor(a_Rhs.y))), + z(static_cast<T>(std::floor(a_Rhs.z))) + { + } // tolua_begin inline void Set(T a_x, T a_y, T a_z) |