Make swizzles explicit

This commit is contained in:
Joshua Ashton 2023-01-11 14:10:07 +00:00
parent 63d2a6e318
commit a7c114cf5f
1 changed files with 6 additions and 18 deletions

View File

@ -88,12 +88,8 @@ namespace orange
copy(&components[0], &components[2], data.begin());
}
template <typename... Args>
constexpr Swizzle(const Args&... args)
: data {{ args... }}
{
static_assert(sizeof...(Args) == 2);
}
constexpr Swizzle(T x, T y)
: data {{ x, y }} {}
constexpr Swizzle(const Swizzle& other) = default;
};
@ -131,12 +127,8 @@ namespace orange
copy(&components[0], &components[3], data.begin());
}
template <typename... Args>
constexpr Swizzle(const Args&... args)
: data {{ args... }}
{
static_assert(sizeof...(Args) == 3);
}
constexpr Swizzle(T x, T y, T z)
: data {{ x, y, z }} {}
constexpr Swizzle(const Swizzle& other) = default;
};
@ -176,12 +168,8 @@ namespace orange
copy(&components[0], &components[4], data.begin());
}
template <typename... Args>
constexpr Swizzle(const Args&... args)
: data {{ args... }}
{
static_assert(sizeof...(Args) == 4);
}
constexpr Swizzle(T x, T y, T z, T w)
: data {{ x, y, z, w }} {}
constexpr Swizzle(const Swizzle& other) = default;
};