Hello!
I can't get to do much constexpr math with the glm::quat type on visual studio because member are not constepxr accessible.
constexpr float x = myQuat.x; // do not evaluate to a constant expression
constexpr float y = myQuat[1]; // do not evaluate to a constant expression
Are not constexpr on MSVC because it is defined as a union of a struct and a detail::storage type.
This seems to have been setup something like 8 years ago when I look at the git blame history, and the GLM_LANG_CXXMS_FLAG flag does not seem to do similar things with similar types like vectors.
is this union still strictly necessary in MSVC? Am I missing something important there reguarding alignment on MSVC or other constraints?
Thanks!
glm\detail\type_quat.hpp
struct qua
{
// -- Implementation detail --
typedef qua<T, Q> type;
typedef T value_type;
// -- Data --
# if GLM_LANG & GLM_LANG_CXXMS_FLAG
union
{
# ifdef GLM_FORCE_QUAT_DATA_WXYZ
struct { T w, x, y, z; };
# else
struct { T x, y, z, w; };
# endif
typename detail::storage<4, T, detail::is_aligned<Q>::value>::type data;
};
# else
# ifdef GLM_FORCE_QUAT_DATA_WXYZ
T w, x, y, z;
# else
T x, y, z, w;
# endif
# endif
[...]
Hello!
I can't get to do much constexpr math with the glm::quat type on visual studio because member are not constepxr accessible.
Are not constexpr on MSVC because it is defined as a union of a struct and a detail::storage type.
This seems to have been setup something like 8 years ago when I look at the git blame history, and the GLM_LANG_CXXMS_FLAG flag does not seem to do similar things with similar types like vectors.
is this union still strictly necessary in MSVC? Am I missing something important there reguarding alignment on MSVC or other constraints?
Thanks!
glm\detail\type_quat.hpp