From 33e84ffae89d521529e34f91a71df0581c7305ba Mon Sep 17 00:00:00 2001 From: chinmaychahar Date: Sat, 13 Jun 2026 14:27:19 +0530 Subject: [PATCH 1/2] Replace =delete with SFINAE for invalid Vec integer methods (#559) Signed-off-by: maychin Signed-off-by: chinmaychahar --- src/Imath/ImathVec.h | 226 +++++++++---------------------------------- 1 file changed, 47 insertions(+), 179 deletions(-) diff --git a/src/Imath/ImathVec.h b/src/Imath/ImathVec.h index 86e73d88..621fabe6 100644 --- a/src/Imath/ImathVec.h +++ b/src/Imath/ImathVec.h @@ -280,6 +280,7 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec2 /// @name Query and Manipulation /// Return the Euclidean norm + template ::value)> IMATH_HOSTDEVICE T length () const IMATH_NOEXCEPT; /// Return the square of the Euclidean norm, i.e. the dot product @@ -287,27 +288,33 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec2 IMATH_HOSTDEVICE constexpr T length2 () const IMATH_NOEXCEPT; /// Normalize in place. If length()==0, return a null vector. + template ::value)> IMATH_HOSTDEVICE const Vec2& normalize () IMATH_NOEXCEPT; /// Normalize in place. If length()==0, throw an exception. + template ::value)> const Vec2& normalizeExc (); /// Normalize without any checks for length()==0. Slightly faster /// than the other normalization routines, but if v.length() is /// 0.0, the result is undefined. + template ::value)> IMATH_HOSTDEVICE const Vec2& normalizeNonNull () IMATH_NOEXCEPT; /// Return a normalized vector. Does not modify *this. + template ::value)> IMATH_HOSTDEVICE Vec2 normalized () const IMATH_NOEXCEPT; /// Return a normalized vector. Does not modify *this. Throw an /// exception if length()==0. + template ::value)> Vec2 normalizedExc () const; /// Return a normalized vector. Does not modify *this, and does /// not check for length()==0. Slightly faster than the other /// normalization routines, but if v.length() is 0.0, the result /// is undefined. + template ::value)> IMATH_HOSTDEVICE Vec2 normalizedNonNull () const IMATH_NOEXCEPT; /// @} @@ -612,6 +619,7 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec3 /// @name Query and Manipulation /// Return the Euclidean norm + template ::value)> IMATH_HOSTDEVICE T length () const IMATH_NOEXCEPT; /// Return the square of the Euclidean norm, i.e. the dot product @@ -619,28 +627,33 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec3 IMATH_HOSTDEVICE constexpr T length2 () const IMATH_NOEXCEPT; /// Normalize in place. If length()==0, return a null vector. + template ::value)> IMATH_HOSTDEVICE const Vec3& normalize () IMATH_NOEXCEPT; /// Normalize in place. If length()==0, throw an exception. + template ::value)> const Vec3& normalizeExc (); /// Normalize without any checks for length()==0. Slightly faster /// than the other normalization routines, but if v.length() is /// 0.0, the result is undefined. + template ::value)> IMATH_HOSTDEVICE const Vec3& normalizeNonNull () IMATH_NOEXCEPT; /// Return a normalized vector. Does not modify *this. - IMATH_HOSTDEVICE Vec3 - normalized () const IMATH_NOEXCEPT; // does not modify *this + template ::value)> + IMATH_HOSTDEVICE Vec3 normalized () const IMATH_NOEXCEPT; /// Return a normalized vector. Does not modify *this. Throw an /// exception if length()==0. + template ::value)> Vec3 normalizedExc () const; /// Return a normalized vector. Does not modify *this, and does /// not check for length()==0. Slightly faster than the other /// normalization routines, but if v.length() is 0.0, the result /// is undefined. + template ::value)> IMATH_HOSTDEVICE Vec3 normalizedNonNull () const IMATH_NOEXCEPT; /// @} @@ -926,6 +939,7 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec4 /// @name Query and Manipulation /// Return the Euclidean norm + template ::value)> IMATH_HOSTDEVICE T length () const IMATH_NOEXCEPT; /// Return the square of the Euclidean norm, i.e. the dot product @@ -933,28 +947,33 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec4 IMATH_HOSTDEVICE constexpr T length2 () const IMATH_NOEXCEPT; /// Normalize in place. If length()==0, return a null vector. - IMATH_HOSTDEVICE const Vec4& normalize () IMATH_NOEXCEPT; // modifies *this + template ::value)> + IMATH_HOSTDEVICE const Vec4& normalize () IMATH_NOEXCEPT; /// Normalize in place. If length()==0, throw an exception. + template ::value)> const Vec4& normalizeExc (); /// Normalize without any checks for length()==0. Slightly faster /// than the other normalization routines, but if v.length() is /// 0.0, the result is undefined. + template ::value)> IMATH_HOSTDEVICE const Vec4& normalizeNonNull () IMATH_NOEXCEPT; /// Return a normalized vector. Does not modify *this. - IMATH_HOSTDEVICE Vec4 - normalized () const IMATH_NOEXCEPT; // does not modify *this + template ::value)> + IMATH_HOSTDEVICE Vec4 normalized () const IMATH_NOEXCEPT; /// Return a normalized vector. Does not modify *this. Throw an /// exception if length()==0. + template ::value)> Vec4 normalizedExc () const; /// Return a normalized vector. Does not modify *this, and does /// not check for length()==0. Slightly faster than the other /// normalization routines, but if v.length() is 0.0, the result /// is undefined. + template ::value)> IMATH_HOSTDEVICE Vec4 normalizedNonNull () const IMATH_NOEXCEPT; /// @} @@ -1084,178 +1103,6 @@ typedef Vec4 V4f; /// Vec4 of double typedef Vec4 V4d; -//---------------------------------------------------------------------------- -// Specializations for VecN, VecN -// -// Normalize and length don't make sense for integer vectors, so disable them. -//---------------------------------------------------------------------------- - -/// @cond Doxygen_Suppress - -// Vec2 -template <> -IMATH_HOSTDEVICE short Vec2::length () const IMATH_NOEXCEPT = delete; -template <> -IMATH_HOSTDEVICE const Vec2& - Vec2::normalize () IMATH_NOEXCEPT = delete; -template <> const Vec2& Vec2::normalizeExc () = delete; -template <> -IMATH_HOSTDEVICE const Vec2& - Vec2::normalizeNonNull () IMATH_NOEXCEPT = delete; -template <> -IMATH_HOSTDEVICE Vec2 - Vec2::normalized () const IMATH_NOEXCEPT = delete; -template <> Vec2 Vec2::normalizedExc () const = delete; -template <> -IMATH_HOSTDEVICE Vec2 -Vec2::normalizedNonNull () const IMATH_NOEXCEPT = delete; - -// Vec2 -template <> -IMATH_HOSTDEVICE int Vec2::length () const IMATH_NOEXCEPT = delete; -template <> -IMATH_HOSTDEVICE const Vec2& - Vec2::normalize () IMATH_NOEXCEPT = delete; -template <> const Vec2& Vec2::normalizeExc () = delete; -template <> -IMATH_HOSTDEVICE const Vec2& - Vec2::normalizeNonNull () IMATH_NOEXCEPT = delete; -template <> -IMATH_HOSTDEVICE Vec2 - Vec2::normalized () const IMATH_NOEXCEPT = delete; -template <> Vec2 Vec2::normalizedExc () const = delete; -template <> -IMATH_HOSTDEVICE Vec2 - Vec2::normalizedNonNull () const IMATH_NOEXCEPT = delete; - -// Vec2 -template <> -IMATH_HOSTDEVICE int64_t Vec2::length () const IMATH_NOEXCEPT = delete; -template <> -IMATH_HOSTDEVICE const Vec2& - Vec2::normalize () IMATH_NOEXCEPT = delete; -template <> const Vec2& Vec2::normalizeExc () = delete; -template <> -IMATH_HOSTDEVICE const Vec2& -Vec2::normalizeNonNull () IMATH_NOEXCEPT = delete; -template <> -IMATH_HOSTDEVICE Vec2 - Vec2::normalized () const IMATH_NOEXCEPT = delete; -template <> Vec2 Vec2::normalizedExc () const = delete; -template <> -IMATH_HOSTDEVICE Vec2 -Vec2::normalizedNonNull () const IMATH_NOEXCEPT = delete; - -// Vec3 -template <> -IMATH_HOSTDEVICE short Vec3::length () const IMATH_NOEXCEPT = delete; -template <> -IMATH_HOSTDEVICE const Vec3& - Vec3::normalize () IMATH_NOEXCEPT = delete; -template <> const Vec3& Vec3::normalizeExc () = delete; -template <> -IMATH_HOSTDEVICE const Vec3& - Vec3::normalizeNonNull () IMATH_NOEXCEPT = delete; -template <> -IMATH_HOSTDEVICE Vec3 - Vec3::normalized () const IMATH_NOEXCEPT = delete; -template <> Vec3 Vec3::normalizedExc () const = delete; -template <> -IMATH_HOSTDEVICE Vec3 -Vec3::normalizedNonNull () const IMATH_NOEXCEPT = delete; - -// Vec3 -template <> -IMATH_HOSTDEVICE int Vec3::length () const IMATH_NOEXCEPT = delete; -template <> -IMATH_HOSTDEVICE const Vec3& - Vec3::normalize () IMATH_NOEXCEPT = delete; -template <> const Vec3& Vec3::normalizeExc () = delete; -template <> -IMATH_HOSTDEVICE const Vec3& - Vec3::normalizeNonNull () IMATH_NOEXCEPT = delete; -template <> -IMATH_HOSTDEVICE Vec3 - Vec3::normalized () const IMATH_NOEXCEPT = delete; -template <> Vec3 Vec3::normalizedExc () const = delete; -template <> -IMATH_HOSTDEVICE Vec3 - Vec3::normalizedNonNull () const IMATH_NOEXCEPT = delete; - -// Vec3 -template <> -IMATH_HOSTDEVICE int64_t Vec3::length () const IMATH_NOEXCEPT = delete; -template <> -IMATH_HOSTDEVICE const Vec3& - Vec3::normalize () IMATH_NOEXCEPT = delete; -template <> const Vec3& Vec3::normalizeExc () = delete; -template <> -IMATH_HOSTDEVICE const Vec3& -Vec3::normalizeNonNull () IMATH_NOEXCEPT = delete; -template <> -IMATH_HOSTDEVICE Vec3 - Vec3::normalized () const IMATH_NOEXCEPT = delete; -template <> Vec3 Vec3::normalizedExc () const = delete; -template <> -IMATH_HOSTDEVICE Vec3 -Vec3::normalizedNonNull () const IMATH_NOEXCEPT = delete; - -// Vec4 -template <> -IMATH_HOSTDEVICE short Vec4::length () const IMATH_NOEXCEPT = delete; -template <> -IMATH_HOSTDEVICE const Vec4& - Vec4::normalize () IMATH_NOEXCEPT = delete; -template <> const Vec4& Vec4::normalizeExc () = delete; -template <> -IMATH_HOSTDEVICE const Vec4& - Vec4::normalizeNonNull () IMATH_NOEXCEPT = delete; -template <> -IMATH_HOSTDEVICE Vec4 - Vec4::normalized () const IMATH_NOEXCEPT = delete; -template <> Vec4 Vec4::normalizedExc () const = delete; -template <> -IMATH_HOSTDEVICE Vec4 -Vec4::normalizedNonNull () const IMATH_NOEXCEPT = delete; - -// Vec4 -template <> -IMATH_HOSTDEVICE int Vec4::length () const IMATH_NOEXCEPT = delete; -template <> -IMATH_HOSTDEVICE const Vec4& - Vec4::normalize () IMATH_NOEXCEPT = delete; -template <> const Vec4& Vec4::normalizeExc () = delete; -template <> -IMATH_HOSTDEVICE const Vec4& - Vec4::normalizeNonNull () IMATH_NOEXCEPT = delete; -template <> -IMATH_HOSTDEVICE Vec4 - Vec4::normalized () const IMATH_NOEXCEPT = delete; -template <> Vec4 Vec4::normalizedExc () const = delete; -template <> -IMATH_HOSTDEVICE Vec4 - Vec4::normalizedNonNull () const IMATH_NOEXCEPT = delete; - -// Vec4 -template <> -IMATH_HOSTDEVICE int64_t Vec4::length () const IMATH_NOEXCEPT = delete; -template <> -IMATH_HOSTDEVICE const Vec4& - Vec4::normalize () IMATH_NOEXCEPT = delete; -template <> const Vec4& Vec4::normalizeExc () = delete; -template <> -IMATH_HOSTDEVICE const Vec4& -Vec4::normalizeNonNull () IMATH_NOEXCEPT = delete; -template <> -IMATH_HOSTDEVICE Vec4 - Vec4::normalized () const IMATH_NOEXCEPT = delete; -template <> Vec4 Vec4::normalizedExc () const = delete; -template <> -IMATH_HOSTDEVICE Vec4 -Vec4::normalizedNonNull () const IMATH_NOEXCEPT = delete; - -/// @endcond Doxygen_Suppress - //------------------------ // Implementation of Vec2: //------------------------ @@ -1579,6 +1426,7 @@ Vec2::lengthTiny () const IMATH_NOEXCEPT } template +template ::value, int>> IMATH_HOSTDEVICE inline T Vec2::length () const IMATH_NOEXCEPT { @@ -1598,6 +1446,7 @@ Vec2::length2 () const IMATH_NOEXCEPT } template +template ::value, int>> IMATH_HOSTDEVICE inline const Vec2& Vec2::normalize () IMATH_NOEXCEPT { @@ -1619,6 +1468,7 @@ Vec2::normalize () IMATH_NOEXCEPT } template +template ::value, int>> inline const Vec2& Vec2::normalizeExc () { @@ -1633,6 +1483,7 @@ Vec2::normalizeExc () } template +template ::value, int>> IMATH_HOSTDEVICE inline const Vec2& Vec2::normalizeNonNull () IMATH_NOEXCEPT { @@ -1643,6 +1494,7 @@ Vec2::normalizeNonNull () IMATH_NOEXCEPT } template +template ::value, int>> IMATH_HOSTDEVICE inline Vec2 Vec2::normalized () const IMATH_NOEXCEPT { @@ -1654,6 +1506,7 @@ Vec2::normalized () const IMATH_NOEXCEPT } template +template ::value, int>> inline Vec2 Vec2::normalizedExc () const { @@ -1666,6 +1519,7 @@ Vec2::normalizedExc () const } template +template ::value, int>> IMATH_HOSTDEVICE inline Vec2 Vec2::normalizedNonNull () const IMATH_NOEXCEPT { @@ -2060,6 +1914,7 @@ Vec3::lengthTiny () const IMATH_NOEXCEPT } template +template ::value, int>> IMATH_HOSTDEVICE inline T Vec3::length () const IMATH_NOEXCEPT { @@ -2079,6 +1934,7 @@ Vec3::length2 () const IMATH_NOEXCEPT } template +template ::value, int>> IMATH_HOSTDEVICE inline const Vec3& Vec3::normalize () IMATH_NOEXCEPT { @@ -2101,6 +1957,7 @@ Vec3::normalize () IMATH_NOEXCEPT } template +template ::value, int>> inline const Vec3& Vec3::normalizeExc () { @@ -2116,6 +1973,7 @@ Vec3::normalizeExc () } template +template ::value, int>> IMATH_HOSTDEVICE inline const Vec3& Vec3::normalizeNonNull () IMATH_NOEXCEPT { @@ -2127,6 +1985,7 @@ Vec3::normalizeNonNull () IMATH_NOEXCEPT } template +template ::value, int>> IMATH_HOSTDEVICE inline Vec3 Vec3::normalized () const IMATH_NOEXCEPT { @@ -2138,6 +1997,7 @@ Vec3::normalized () const IMATH_NOEXCEPT } template +template ::value, int>> inline Vec3 Vec3::normalizedExc () const { @@ -2150,6 +2010,7 @@ Vec3::normalizedExc () const } template +template ::value, int>> IMATH_HOSTDEVICE inline Vec3 Vec3::normalizedNonNull () const IMATH_NOEXCEPT { @@ -2514,6 +2375,7 @@ Vec4::lengthTiny () const IMATH_NOEXCEPT } template +template ::value, int>> IMATH_HOSTDEVICE inline T Vec4::length () const IMATH_NOEXCEPT { @@ -2533,7 +2395,8 @@ Vec4::length2 () const IMATH_NOEXCEPT } template -IMATH_HOSTDEVICE const inline Vec4& +template ::value, int>> +IMATH_HOSTDEVICE inline const Vec4& Vec4::normalize () IMATH_NOEXCEPT { T l = length (); @@ -2556,7 +2419,8 @@ Vec4::normalize () IMATH_NOEXCEPT } template -const inline Vec4& +template ::value, int>> +inline const Vec4& Vec4::normalizeExc () { T l = length (); @@ -2572,6 +2436,7 @@ Vec4::normalizeExc () } template +template ::value, int>> IMATH_HOSTDEVICE inline const Vec4& Vec4::normalizeNonNull () IMATH_NOEXCEPT { @@ -2584,6 +2449,7 @@ Vec4::normalizeNonNull () IMATH_NOEXCEPT } template +template ::value, int>> IMATH_HOSTDEVICE inline Vec4 Vec4::normalized () const IMATH_NOEXCEPT { @@ -2595,6 +2461,7 @@ Vec4::normalized () const IMATH_NOEXCEPT } template +template ::value, int>> inline Vec4 Vec4::normalizedExc () const { @@ -2607,6 +2474,7 @@ Vec4::normalizedExc () const } template +template ::value, int>> IMATH_HOSTDEVICE inline Vec4 Vec4::normalizedNonNull () const IMATH_NOEXCEPT { From 326e68b1e7fd7a36fb59b061ba50bb8a139ceb5e Mon Sep 17 00:00:00 2001 From: chinmaychahar Date: Sat, 27 Jun 2026 14:01:27 +0530 Subject: [PATCH 2/2] Add is_float_like trait and use it for SFINAE guards Signed-off-by: chinmaychahar --- src/Imath/ImathTypeTraits.h | 6 +++ src/Imath/ImathVec.h | 87 +++++++++++++++++++------------------ 2 files changed, 51 insertions(+), 42 deletions(-) diff --git a/src/Imath/ImathTypeTraits.h b/src/Imath/ImathTypeTraits.h index c3ad212a..0bde27af 100644 --- a/src/Imath/ImathTypeTraits.h +++ b/src/Imath/ImathTypeTraits.h @@ -30,6 +30,12 @@ using enable_if_t = typename std::enable_if::type; #define IMATH_ENABLE_IF(...) \ IMATH_INTERNAL_NAMESPACE::enable_if_t<(__VA_ARGS__), int> = 0 +/// A type trait that identifies types for which Vec length/normalize operations +/// are meaningful. Defaults to std::is_floating_point, with a specialization +/// for half. +template +struct is_float_like : public std::is_floating_point {}; + #if IMATH_FOREIGN_VECTOR_INTEROP /// @{ diff --git a/src/Imath/ImathVec.h b/src/Imath/ImathVec.h index 621fabe6..fd433421 100644 --- a/src/Imath/ImathVec.h +++ b/src/Imath/ImathVec.h @@ -36,6 +36,9 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER +/// Specialization so that Vec supports length/normalize. +template <> struct is_float_like : public std::true_type {}; + template class Vec2; template class Vec3; template class Vec4; @@ -280,7 +283,7 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec2 /// @name Query and Manipulation /// Return the Euclidean norm - template ::value)> + template ::value)> IMATH_HOSTDEVICE T length () const IMATH_NOEXCEPT; /// Return the square of the Euclidean norm, i.e. the dot product @@ -288,33 +291,33 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec2 IMATH_HOSTDEVICE constexpr T length2 () const IMATH_NOEXCEPT; /// Normalize in place. If length()==0, return a null vector. - template ::value)> + template ::value)> IMATH_HOSTDEVICE const Vec2& normalize () IMATH_NOEXCEPT; /// Normalize in place. If length()==0, throw an exception. - template ::value)> + template ::value)> const Vec2& normalizeExc (); /// Normalize without any checks for length()==0. Slightly faster /// than the other normalization routines, but if v.length() is /// 0.0, the result is undefined. - template ::value)> + template ::value)> IMATH_HOSTDEVICE const Vec2& normalizeNonNull () IMATH_NOEXCEPT; /// Return a normalized vector. Does not modify *this. - template ::value)> + template ::value)> IMATH_HOSTDEVICE Vec2 normalized () const IMATH_NOEXCEPT; /// Return a normalized vector. Does not modify *this. Throw an /// exception if length()==0. - template ::value)> + template ::value)> Vec2 normalizedExc () const; /// Return a normalized vector. Does not modify *this, and does /// not check for length()==0. Slightly faster than the other /// normalization routines, but if v.length() is 0.0, the result /// is undefined. - template ::value)> + template ::value)> IMATH_HOSTDEVICE Vec2 normalizedNonNull () const IMATH_NOEXCEPT; /// @} @@ -619,7 +622,7 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec3 /// @name Query and Manipulation /// Return the Euclidean norm - template ::value)> + template ::value)> IMATH_HOSTDEVICE T length () const IMATH_NOEXCEPT; /// Return the square of the Euclidean norm, i.e. the dot product @@ -627,33 +630,33 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec3 IMATH_HOSTDEVICE constexpr T length2 () const IMATH_NOEXCEPT; /// Normalize in place. If length()==0, return a null vector. - template ::value)> + template ::value)> IMATH_HOSTDEVICE const Vec3& normalize () IMATH_NOEXCEPT; /// Normalize in place. If length()==0, throw an exception. - template ::value)> + template ::value)> const Vec3& normalizeExc (); /// Normalize without any checks for length()==0. Slightly faster /// than the other normalization routines, but if v.length() is /// 0.0, the result is undefined. - template ::value)> + template ::value)> IMATH_HOSTDEVICE const Vec3& normalizeNonNull () IMATH_NOEXCEPT; /// Return a normalized vector. Does not modify *this. - template ::value)> + template ::value)> IMATH_HOSTDEVICE Vec3 normalized () const IMATH_NOEXCEPT; /// Return a normalized vector. Does not modify *this. Throw an /// exception if length()==0. - template ::value)> + template ::value)> Vec3 normalizedExc () const; /// Return a normalized vector. Does not modify *this, and does /// not check for length()==0. Slightly faster than the other /// normalization routines, but if v.length() is 0.0, the result /// is undefined. - template ::value)> + template ::value)> IMATH_HOSTDEVICE Vec3 normalizedNonNull () const IMATH_NOEXCEPT; /// @} @@ -939,7 +942,7 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec4 /// @name Query and Manipulation /// Return the Euclidean norm - template ::value)> + template ::value)> IMATH_HOSTDEVICE T length () const IMATH_NOEXCEPT; /// Return the square of the Euclidean norm, i.e. the dot product @@ -947,33 +950,33 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec4 IMATH_HOSTDEVICE constexpr T length2 () const IMATH_NOEXCEPT; /// Normalize in place. If length()==0, return a null vector. - template ::value)> + template ::value)> IMATH_HOSTDEVICE const Vec4& normalize () IMATH_NOEXCEPT; /// Normalize in place. If length()==0, throw an exception. - template ::value)> + template ::value)> const Vec4& normalizeExc (); /// Normalize without any checks for length()==0. Slightly faster /// than the other normalization routines, but if v.length() is /// 0.0, the result is undefined. - template ::value)> + template ::value)> IMATH_HOSTDEVICE const Vec4& normalizeNonNull () IMATH_NOEXCEPT; /// Return a normalized vector. Does not modify *this. - template ::value)> + template ::value)> IMATH_HOSTDEVICE Vec4 normalized () const IMATH_NOEXCEPT; /// Return a normalized vector. Does not modify *this. Throw an /// exception if length()==0. - template ::value)> + template ::value)> Vec4 normalizedExc () const; /// Return a normalized vector. Does not modify *this, and does /// not check for length()==0. Slightly faster than the other /// normalization routines, but if v.length() is 0.0, the result /// is undefined. - template ::value)> + template ::value)> IMATH_HOSTDEVICE Vec4 normalizedNonNull () const IMATH_NOEXCEPT; /// @} @@ -1426,7 +1429,7 @@ Vec2::lengthTiny () const IMATH_NOEXCEPT } template -template ::value, int>> +template ::value, int>> IMATH_HOSTDEVICE inline T Vec2::length () const IMATH_NOEXCEPT { @@ -1446,7 +1449,7 @@ Vec2::length2 () const IMATH_NOEXCEPT } template -template ::value, int>> +template ::value, int>> IMATH_HOSTDEVICE inline const Vec2& Vec2::normalize () IMATH_NOEXCEPT { @@ -1468,7 +1471,7 @@ Vec2::normalize () IMATH_NOEXCEPT } template -template ::value, int>> +template ::value, int>> inline const Vec2& Vec2::normalizeExc () { @@ -1483,7 +1486,7 @@ Vec2::normalizeExc () } template -template ::value, int>> +template ::value, int>> IMATH_HOSTDEVICE inline const Vec2& Vec2::normalizeNonNull () IMATH_NOEXCEPT { @@ -1494,7 +1497,7 @@ Vec2::normalizeNonNull () IMATH_NOEXCEPT } template -template ::value, int>> +template ::value, int>> IMATH_HOSTDEVICE inline Vec2 Vec2::normalized () const IMATH_NOEXCEPT { @@ -1506,7 +1509,7 @@ Vec2::normalized () const IMATH_NOEXCEPT } template -template ::value, int>> +template ::value, int>> inline Vec2 Vec2::normalizedExc () const { @@ -1519,7 +1522,7 @@ Vec2::normalizedExc () const } template -template ::value, int>> +template ::value, int>> IMATH_HOSTDEVICE inline Vec2 Vec2::normalizedNonNull () const IMATH_NOEXCEPT { @@ -1914,7 +1917,7 @@ Vec3::lengthTiny () const IMATH_NOEXCEPT } template -template ::value, int>> +template ::value, int>> IMATH_HOSTDEVICE inline T Vec3::length () const IMATH_NOEXCEPT { @@ -1934,7 +1937,7 @@ Vec3::length2 () const IMATH_NOEXCEPT } template -template ::value, int>> +template ::value, int>> IMATH_HOSTDEVICE inline const Vec3& Vec3::normalize () IMATH_NOEXCEPT { @@ -1957,7 +1960,7 @@ Vec3::normalize () IMATH_NOEXCEPT } template -template ::value, int>> +template ::value, int>> inline const Vec3& Vec3::normalizeExc () { @@ -1973,7 +1976,7 @@ Vec3::normalizeExc () } template -template ::value, int>> +template ::value, int>> IMATH_HOSTDEVICE inline const Vec3& Vec3::normalizeNonNull () IMATH_NOEXCEPT { @@ -1985,7 +1988,7 @@ Vec3::normalizeNonNull () IMATH_NOEXCEPT } template -template ::value, int>> +template ::value, int>> IMATH_HOSTDEVICE inline Vec3 Vec3::normalized () const IMATH_NOEXCEPT { @@ -1997,7 +2000,7 @@ Vec3::normalized () const IMATH_NOEXCEPT } template -template ::value, int>> +template ::value, int>> inline Vec3 Vec3::normalizedExc () const { @@ -2010,7 +2013,7 @@ Vec3::normalizedExc () const } template -template ::value, int>> +template ::value, int>> IMATH_HOSTDEVICE inline Vec3 Vec3::normalizedNonNull () const IMATH_NOEXCEPT { @@ -2375,7 +2378,7 @@ Vec4::lengthTiny () const IMATH_NOEXCEPT } template -template ::value, int>> +template ::value, int>> IMATH_HOSTDEVICE inline T Vec4::length () const IMATH_NOEXCEPT { @@ -2395,7 +2398,7 @@ Vec4::length2 () const IMATH_NOEXCEPT } template -template ::value, int>> +template ::value, int>> IMATH_HOSTDEVICE inline const Vec4& Vec4::normalize () IMATH_NOEXCEPT { @@ -2419,7 +2422,7 @@ Vec4::normalize () IMATH_NOEXCEPT } template -template ::value, int>> +template ::value, int>> inline const Vec4& Vec4::normalizeExc () { @@ -2436,7 +2439,7 @@ Vec4::normalizeExc () } template -template ::value, int>> +template ::value, int>> IMATH_HOSTDEVICE inline const Vec4& Vec4::normalizeNonNull () IMATH_NOEXCEPT { @@ -2449,7 +2452,7 @@ Vec4::normalizeNonNull () IMATH_NOEXCEPT } template -template ::value, int>> +template ::value, int>> IMATH_HOSTDEVICE inline Vec4 Vec4::normalized () const IMATH_NOEXCEPT { @@ -2461,7 +2464,7 @@ Vec4::normalized () const IMATH_NOEXCEPT } template -template ::value, int>> +template ::value, int>> inline Vec4 Vec4::normalizedExc () const { @@ -2474,7 +2477,7 @@ Vec4::normalizedExc () const } template -template ::value, int>> +template ::value, int>> IMATH_HOSTDEVICE inline Vec4 Vec4::normalizedNonNull () const IMATH_NOEXCEPT {