Skip to content

Commit

Permalink
Fix calling default constructor by uniform init. (AcademySoftwareFoun…
Browse files Browse the repository at this point in the history
…dation#340)

I fixed calling default constructor in ImathTypeTraits.h by using
uniform initialization.

Signed-off-by: Yuya Asano <64895419+sukeya@users.noreply.github.com>
  • Loading branch information
sukeya authored Aug 3, 2023
1 parent 6346a15 commit c206739
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/Imath/ImathTypeTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ template <typename T, typename Base> struct has_xy
// Valid only if .x, .y exist and are the right type: return a Yes.
template <
typename C,
IMATH_ENABLE_IF (std::is_same<decltype (C ().x), Base>::value),
IMATH_ENABLE_IF (std::is_same<decltype (C ().y), Base>::value)>
IMATH_ENABLE_IF (std::is_same<decltype (C {}.x), Base>::value),
IMATH_ENABLE_IF (std::is_same<decltype (C {}.y), Base>::value)>
static Yes& test (int);

// Fallback, default to returning a No.
Expand All @@ -113,9 +113,9 @@ template <typename T, typename Base> struct has_xyz
// Valid only if .x, .y, .z exist and are the right type: return a Yes.
template <
typename C,
IMATH_ENABLE_IF (std::is_same<decltype (C ().x), Base>::value),
IMATH_ENABLE_IF (std::is_same<decltype (C ().y), Base>::value),
IMATH_ENABLE_IF (std::is_same<decltype (C ().z), Base>::value)>
IMATH_ENABLE_IF (std::is_same<decltype (C {}.x), Base>::value),
IMATH_ENABLE_IF (std::is_same<decltype (C {}.y), Base>::value),
IMATH_ENABLE_IF (std::is_same<decltype (C {}.z), Base>::value)>
static Yes& test (int);

// Fallback, default to returning a No.
Expand All @@ -142,10 +142,10 @@ template <typename T, typename Base> struct has_xyzw
// Valid only if .x, .y, .z, .w exist and are the right type: return a Yes.
template <
typename C,
IMATH_ENABLE_IF (std::is_same<decltype (C ().x), Base>::value),
IMATH_ENABLE_IF (std::is_same<decltype (C ().y), Base>::value),
IMATH_ENABLE_IF (std::is_same<decltype (C ().z), Base>::value),
IMATH_ENABLE_IF (std::is_same<decltype (C ().w), Base>::value)>
IMATH_ENABLE_IF (std::is_same<decltype (C {}.x), Base>::value),
IMATH_ENABLE_IF (std::is_same<decltype (C {}.y), Base>::value),
IMATH_ENABLE_IF (std::is_same<decltype (C {}.z), Base>::value),
IMATH_ENABLE_IF (std::is_same<decltype (C {}.w), Base>::value)>
static Yes& test (int);

// Fallback, default to returning a No.
Expand Down Expand Up @@ -173,7 +173,7 @@ template <typename T, typename Base, int Nelem> struct has_subscript
template <
typename C,
IMATH_ENABLE_IF (std::is_same<
typename std::decay<decltype (C ()[0])>::type,
typename std::decay<decltype (C {}[0])>::type,
Base>::value)>
static Yes& test (int);

Expand Down Expand Up @@ -208,7 +208,7 @@ struct has_double_subscript
template <
typename C,
IMATH_ENABLE_IF (std::is_same<
typename std::decay<decltype (C ()[0][0])>::type,
typename std::decay<decltype (C {}[0][0])>::type,
Base>::value)>
static Yes& test (int);

Expand Down

0 comments on commit c206739

Please sign in to comment.