From 2254432ebed0cc7dfbc8125d5b99db0e3336fccf Mon Sep 17 00:00:00 2001 From: Yuya Asano <64895419+sukeya@users.noreply.github.com> Date: Thu, 3 Aug 2023 23:58:04 +0900 Subject: [PATCH] Fix calling default constructor by uniform init. (#340) I fixed calling default constructor in ImathTypeTraits.h by using uniform initialization. Signed-off-by: Yuya Asano <64895419+sukeya@users.noreply.github.com> --- src/Imath/ImathTypeTraits.h | 51 ++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/src/Imath/ImathTypeTraits.h b/src/Imath/ImathTypeTraits.h index 4e8447d3..66b474b7 100644 --- a/src/Imath/ImathTypeTraits.h +++ b/src/Imath/ImathTypeTraits.h @@ -86,10 +86,11 @@ struct has_xy { typedef char No[2]; // Valid only if .x, .y exist and are the right type: return a Yes. - template::value), - IMATH_ENABLE_IF(std::is_same::value)> - static Yes& test(int); + template < + typename C, + IMATH_ENABLE_IF (std::is_same::value), + IMATH_ENABLE_IF (std::is_same::value)> + static Yes& test (int); // Fallback, default to returning a No. template static No& test(...); @@ -110,11 +111,12 @@ struct has_xyz { typedef char No[2]; // Valid only if .x, .y, .z exist and are the right type: return a Yes. - template::value), - IMATH_ENABLE_IF(std::is_same::value), - IMATH_ENABLE_IF(std::is_same::value)> - static Yes& test(int); + template < + typename C, + IMATH_ENABLE_IF (std::is_same::value), + IMATH_ENABLE_IF (std::is_same::value), + IMATH_ENABLE_IF (std::is_same::value)> + static Yes& test (int); // Fallback, default to returning a No. template static No& test(...); @@ -135,12 +137,13 @@ struct has_xyzw { typedef char No[2]; // Valid only if .x, .y, .z, .w exist and are the right type: return a Yes. - template::value), - IMATH_ENABLE_IF(std::is_same::value), - IMATH_ENABLE_IF(std::is_same::value), - IMATH_ENABLE_IF(std::is_same::value)> - static Yes& test(int); + template < + typename C, + IMATH_ENABLE_IF (std::is_same::value), + IMATH_ENABLE_IF (std::is_same::value), + IMATH_ENABLE_IF (std::is_same::value), + IMATH_ENABLE_IF (std::is_same::value)> + static Yes& test (int); // Fallback, default to returning a No. template static No& test(...); @@ -162,9 +165,12 @@ struct has_subscript { typedef char No[2]; // Valid only if T[] is possible and is the right type: return a Yes. - template::type, Base>::value)> - static Yes& test(int); + template < + typename C, + IMATH_ENABLE_IF (std::is_same< + typename std::decay::type, + Base>::value)> + static Yes& test (int); // Fallback, default to returning a No. template static No& test(...); @@ -191,9 +197,12 @@ struct has_double_subscript { typedef char No[2]; // Valid only if T[][] is possible and is the right type: return a Yes. - template::type, Base>::value)> - static Yes& test(int); + template < + typename C, + IMATH_ENABLE_IF (std::is_same< + typename std::decay::type, + Base>::value)> + static Yes& test (int); // Fallback, default to returning a No. template static No& test(...);