From a56a40e1f29e593edca82a57d0e3bf65ef2f323e Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 25 Jul 2015 21:31:51 +0200 Subject: [PATCH] Added support of defaulted functions to GLM types, to use them in unions #366 --- glm/detail/type_mat2x2.hpp | 10 +++--- glm/detail/type_mat2x2.inl | 47 +++++++++++++------------ glm/detail/type_mat2x3.hpp | 8 ++--- glm/detail/type_mat2x3.inl | 47 +++++++++++++------------ glm/detail/type_mat2x4.hpp | 6 ++-- glm/detail/type_mat2x4.inl | 47 +++++++++++++------------ glm/detail/type_mat3x2.hpp | 7 ++-- glm/detail/type_mat3x2.inl | 53 +++++++++++++++------------- glm/detail/type_mat3x3.hpp | 7 ++-- glm/detail/type_mat3x3.inl | 60 +++++++++++++++++--------------- glm/detail/type_mat3x4.hpp | 7 ++-- glm/detail/type_mat3x4.inl | 53 +++++++++++++++------------- glm/detail/type_mat4x2.hpp | 7 ++-- glm/detail/type_mat4x2.inl | 59 ++++++++++++++++--------------- glm/detail/type_mat4x3.hpp | 8 ++--- glm/detail/type_mat4x3.inl | 58 ++++++++++++++++--------------- glm/detail/type_mat4x4.hpp | 8 ++--- glm/detail/type_mat4x4.inl | 63 ++++++++++++++++++---------------- glm/gtc/quaternion.hpp | 6 ++-- glm/gtc/quaternion.inl | 42 +++++++++++++---------- glm/gtx/dual_quaternion.hpp | 6 ++-- glm/gtx/dual_quaternion.inl | 42 +++++++++++++---------- readme.md | 1 + test/core/core_type_mat2x2.cpp | 16 +++++++++ test/core/core_type_mat2x3.cpp | 18 +++++++++- test/core/core_type_mat2x4.cpp | 18 +++++++++- test/core/core_type_mat3x2.cpp | 18 +++++++++- test/core/core_type_mat3x3.cpp | 18 +++++++++- test/core/core_type_mat3x4.cpp | 18 +++++++++- test/core/core_type_mat4x2.cpp | 16 +++++++++ test/core/core_type_mat4x3.cpp | 16 +++++++++ test/core/core_type_mat4x4.cpp | 16 +++++++++ test/gtc/gtc_quaternion.cpp | 16 +++++++++ 33 files changed, 517 insertions(+), 305 deletions(-) diff --git a/glm/detail/type_mat2x2.hpp b/glm/detail/type_mat2x2.hpp index c24d929a..29585654 100644 --- a/glm/detail/type_mat2x2.hpp +++ b/glm/detail/type_mat2x2.hpp @@ -62,15 +62,14 @@ namespace glm # endif//GLM_META_PROG_HELPERS private: - /// @cond DETAIL col_type value[2]; - /// @endcond public: ////////////////////////////////////// // Constructors - GLM_FUNC_DECL tmat2x2(); - GLM_FUNC_DECL tmat2x2(tmat2x2 const & m); + + GLM_FUNC_DECL tmat2x2() GLM_DEFAULT; + GLM_FUNC_DECL tmat2x2(tmat2x2 const & m) GLM_DEFAULT; template GLM_FUNC_DECL tmat2x2(tmat2x2 const & m); @@ -85,6 +84,7 @@ namespace glm ////////////////////////////////////// // Conversions + template GLM_FUNC_DECL tmat2x2( U const & x1, V const & y1, @@ -130,7 +130,7 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators - GLM_FUNC_DECL tmat2x2 & operator=(tmat2x2 const & v); + GLM_FUNC_DECL tmat2x2 & operator=(tmat2x2 const & v) GLM_DEFAULT;; template GLM_FUNC_DECL tmat2x2 & operator=(tmat2x2 const & m); diff --git a/glm/detail/type_mat2x2.inl b/glm/detail/type_mat2x2.inl index 779cc091..640cb824 100644 --- a/glm/detail/type_mat2x2.inl +++ b/glm/detail/type_mat2x2.inl @@ -53,21 +53,23 @@ namespace detail ////////////////////////////////////////////////////////////// // Constructors - template - GLM_FUNC_QUALIFIER tmat2x2::tmat2x2() - { -# ifndef GLM_FORCE_NO_CTOR_INIT - this->value[0] = col_type(1, 0); - this->value[1] = col_type(0, 1); -# endif - } +# if !GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER tmat2x2::tmat2x2() + { +# ifndef GLM_FORCE_NO_CTOR_INIT + this->value[0] = col_type(1, 0); + this->value[1] = col_type(0, 1); +# endif + } - template - GLM_FUNC_QUALIFIER tmat2x2::tmat2x2(tmat2x2 const & m) - { - this->value[0] = m.value[0]; - this->value[1] = m.value[1]; - } + template + GLM_FUNC_QUALIFIER tmat2x2::tmat2x2(tmat2x2 const & m) + { + this->value[0] = m.value[0]; + this->value[1] = m.value[1]; + } +# endif//!GLM_HAS_DEFAULTED_FUNCTIONS template template @@ -108,6 +110,7 @@ namespace detail ////////////////////////////////////// // Conversion constructors + template template GLM_FUNC_QUALIFIER tmat2x2::tmat2x2 @@ -243,13 +246,15 @@ namespace detail ////////////////////////////////////////////////////////////// // Unary updatable operators - template - GLM_FUNC_QUALIFIER tmat2x2& tmat2x2::operator=(tmat2x2 const & m) - { - this->value[0] = m[0]; - this->value[1] = m[1]; - return *this; - } +# if !GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER tmat2x2& tmat2x2::operator=(tmat2x2 const & m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + return *this; + } +# endif//!GLM_HAS_DEFAULTED_FUNCTIONS template template diff --git a/glm/detail/type_mat2x3.hpp b/glm/detail/type_mat2x3.hpp index f0e4fbdc..76216634 100644 --- a/glm/detail/type_mat2x3.hpp +++ b/glm/detail/type_mat2x3.hpp @@ -58,14 +58,12 @@ namespace glm # endif//GLM_META_PROG_HELPERS private: - /// @cond DETAIL col_type value[2]; - /// @endcond public: // Constructors - GLM_FUNC_DECL tmat2x3(); - GLM_FUNC_DECL tmat2x3(tmat2x3 const & m); + GLM_FUNC_DECL tmat2x3() GLM_DEFAULT; + GLM_FUNC_DECL tmat2x3(tmat2x3 const & m) GLM_DEFAULT; template GLM_FUNC_DECL tmat2x3(tmat2x3 const & m); @@ -126,7 +124,7 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators - GLM_FUNC_DECL tmat2x3 & operator=(tmat2x3 const & m); + GLM_FUNC_DECL tmat2x3 & operator=(tmat2x3 const & m) GLM_DEFAULT; template GLM_FUNC_DECL tmat2x3 & operator=(tmat2x3 const & m); diff --git a/glm/detail/type_mat2x3.inl b/glm/detail/type_mat2x3.inl index 32c30fdd..fd90a807 100644 --- a/glm/detail/type_mat2x3.inl +++ b/glm/detail/type_mat2x3.inl @@ -35,21 +35,23 @@ namespace glm ////////////////////////////////////////////////////////////// // Constructors - template - GLM_FUNC_QUALIFIER tmat2x3::tmat2x3() - { -# ifndef GLM_FORCE_NO_CTOR_INIT - this->value[0] = col_type(1, 0, 0); - this->value[1] = col_type(0, 1, 0); -# endif - } +# if !GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER tmat2x3::tmat2x3() + { +# ifndef GLM_FORCE_NO_CTOR_INIT + this->value[0] = col_type(1, 0, 0); + this->value[1] = col_type(0, 1, 0); +# endif + } - template - GLM_FUNC_QUALIFIER tmat2x3::tmat2x3(tmat2x3 const & m) - { - this->value[0] = m.value[0]; - this->value[1] = m.value[1]; - } + template + GLM_FUNC_QUALIFIER tmat2x3::tmat2x3(tmat2x3 const & m) + { + this->value[0] = m.value[0]; + this->value[1] = m.value[1]; + } +# endif//!GLM_HAS_DEFAULTED_FUNCTIONS template template @@ -90,6 +92,7 @@ namespace glm ////////////////////////////////////// // Conversion constructors + template template < typename X1, typename Y1, typename Z1, @@ -227,13 +230,15 @@ namespace glm ////////////////////////////////////////////////////////////// // Unary updatable operators - template - GLM_FUNC_QUALIFIER tmat2x3& tmat2x3::operator=(tmat2x3 const & m) - { - this->value[0] = m[0]; - this->value[1] = m[1]; - return *this; - } +# if !GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER tmat2x3& tmat2x3::operator=(tmat2x3 const & m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + return *this; + } +# endif//!GLM_HAS_DEFAULTED_FUNCTIONS template template diff --git a/glm/detail/type_mat2x4.hpp b/glm/detail/type_mat2x4.hpp index 6b0f190b..0b3395f9 100644 --- a/glm/detail/type_mat2x4.hpp +++ b/glm/detail/type_mat2x4.hpp @@ -64,8 +64,8 @@ namespace glm public: // Constructors - GLM_FUNC_DECL tmat2x4(); - GLM_FUNC_DECL tmat2x4(tmat2x4 const & m); + GLM_FUNC_DECL tmat2x4() GLM_DEFAULT; + GLM_FUNC_DECL tmat2x4(tmat2x4 const & m) GLM_DEFAULT; template GLM_FUNC_DECL tmat2x4(tmat2x4 const & m); @@ -127,7 +127,7 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators - GLM_FUNC_DECL tmat2x4 & operator=(tmat2x4 const & m); + GLM_FUNC_DECL tmat2x4 & operator=(tmat2x4 const & m) GLM_DEFAULT; template GLM_FUNC_DECL tmat2x4 & operator=(tmat2x4 const & m); diff --git a/glm/detail/type_mat2x4.inl b/glm/detail/type_mat2x4.inl index fcf5d315..6df47937 100644 --- a/glm/detail/type_mat2x4.inl +++ b/glm/detail/type_mat2x4.inl @@ -35,21 +35,23 @@ namespace glm ////////////////////////////////////////////////////////////// // Constructors - template - GLM_FUNC_QUALIFIER tmat2x4::tmat2x4() - { -# ifndef GLM_FORCE_NO_CTOR_INIT - this->value[0] = col_type(1, 0, 0, 0); - this->value[1] = col_type(0, 1, 0, 0); -# endif - } +# if !GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER tmat2x4::tmat2x4() + { +# ifndef GLM_FORCE_NO_CTOR_INIT + this->value[0] = col_type(1, 0, 0, 0); + this->value[1] = col_type(0, 1, 0, 0); +# endif + } - template - GLM_FUNC_QUALIFIER tmat2x4::tmat2x4(tmat2x4 const & m) - { - this->value[0] = m.value[0]; - this->value[1] = m.value[1]; - } + template + GLM_FUNC_QUALIFIER tmat2x4::tmat2x4(tmat2x4 const & m) + { + this->value[0] = m.value[0]; + this->value[1] = m.value[1]; + } +# endif//!GLM_HAS_DEFAULTED_FUNCTIONS template template @@ -91,6 +93,7 @@ namespace glm ////////////////////////////////////// // Conversion constructors + template template < typename X1, typename Y1, typename Z1, typename W1, @@ -228,13 +231,15 @@ namespace glm ////////////////////////////////////////////////////////////// // Unary updatable operators - template - GLM_FUNC_QUALIFIER tmat2x4& tmat2x4::operator=(tmat2x4 const & m) - { - this->value[0] = m[0]; - this->value[1] = m[1]; - return *this; - } +# if !GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER tmat2x4& tmat2x4::operator=(tmat2x4 const & m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + return *this; + } +# endif//!GLM_HAS_DEFAULTED_FUNCTIONS template template diff --git a/glm/detail/type_mat3x2.hpp b/glm/detail/type_mat3x2.hpp index 1ee94214..ff452fbf 100644 --- a/glm/detail/type_mat3x2.hpp +++ b/glm/detail/type_mat3x2.hpp @@ -64,8 +64,9 @@ namespace glm public: // Constructors - GLM_FUNC_DECL tmat3x2(); - GLM_FUNC_DECL tmat3x2(tmat3x2 const & m); + + GLM_FUNC_DECL tmat3x2() GLM_DEFAULT; + GLM_FUNC_DECL tmat3x2(tmat3x2 const & m) GLM_DEFAULT; template GLM_FUNC_DECL tmat3x2(tmat3x2 const & m); @@ -133,7 +134,7 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators - GLM_FUNC_DECL tmat3x2 & operator=(tmat3x2 const & m); + GLM_FUNC_DECL tmat3x2 & operator=(tmat3x2 const & m) GLM_DEFAULT; template GLM_FUNC_DECL tmat3x2 & operator=(tmat3x2 const & m); diff --git a/glm/detail/type_mat3x2.inl b/glm/detail/type_mat3x2.inl index d42a9aec..967a4418 100644 --- a/glm/detail/type_mat3x2.inl +++ b/glm/detail/type_mat3x2.inl @@ -35,23 +35,25 @@ namespace glm ////////////////////////////////////////////////////////////// // Constructors - template - GLM_FUNC_QUALIFIER tmat3x2::tmat3x2() - { -# ifndef GLM_FORCE_NO_CTOR_INIT - this->value[0] = col_type(1, 0); - this->value[1] = col_type(0, 1); - this->value[2] = col_type(0, 0); -# endif - } +# if !GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER tmat3x2::tmat3x2() + { +# ifndef GLM_FORCE_NO_CTOR_INIT + this->value[0] = col_type(1, 0); + this->value[1] = col_type(0, 1); + this->value[2] = col_type(0, 0); +# endif + } - template - GLM_FUNC_QUALIFIER tmat3x2::tmat3x2(tmat3x2 const & m) - { - this->value[0] = m.value[0]; - this->value[1] = m.value[1]; - this->value[2] = m.value[2]; - } + template + GLM_FUNC_QUALIFIER tmat3x2::tmat3x2(tmat3x2 const & m) + { + this->value[0] = m.value[0]; + this->value[1] = m.value[1]; + this->value[2] = m.value[2]; + } +# endif//!GLM_HAS_DEFAULTED_FUNCTIONS template template @@ -102,6 +104,7 @@ namespace glm ////////////////////////////////////// // Conversion constructors + template template < typename X1, typename Y1, @@ -257,14 +260,16 @@ namespace glm ////////////////////////////////////////////////////////////// // Unary updatable operators - template - GLM_FUNC_QUALIFIER tmat3x2& tmat3x2::operator=(tmat3x2 const & m) - { - this->value[0] = m[0]; - this->value[1] = m[1]; - this->value[2] = m[2]; - return *this; - } +# if !GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER tmat3x2& tmat3x2::operator=(tmat3x2 const & m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + this->value[2] = m[2]; + return *this; + } +# endif//!GLM_HAS_DEFAULTED_FUNCTIONS template template diff --git a/glm/detail/type_mat3x3.hpp b/glm/detail/type_mat3x3.hpp index 1ad3e6a2..93608455 100644 --- a/glm/detail/type_mat3x3.hpp +++ b/glm/detail/type_mat3x3.hpp @@ -68,8 +68,9 @@ namespace glm public: // Constructors - GLM_FUNC_DECL tmat3x3(); - GLM_FUNC_DECL tmat3x3(tmat3x3 const & m); + + GLM_FUNC_DECL tmat3x3() GLM_DEFAULT; + GLM_FUNC_DECL tmat3x3(tmat3x3 const & m) GLM_DEFAULT; template GLM_FUNC_DECL tmat3x3(tmat3x3 const & m); @@ -137,7 +138,7 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators - GLM_FUNC_DECL tmat3x3 & operator=(tmat3x3 const & m); + GLM_FUNC_DECL tmat3x3 & operator=(tmat3x3 const & m) GLM_DEFAULT; template GLM_FUNC_DECL tmat3x3 & operator=(tmat3x3 const & m); diff --git a/glm/detail/type_mat3x3.inl b/glm/detail/type_mat3x3.inl index ad933d36..17141fab 100644 --- a/glm/detail/type_mat3x3.inl +++ b/glm/detail/type_mat3x3.inl @@ -59,27 +59,25 @@ namespace detail ////////////////////////////////////////////////////////////// // Constructors - template - GLM_FUNC_QUALIFIER tmat3x3::tmat3x3() - { -# ifndef GLM_FORCE_NO_CTOR_INIT - this->value[0] = col_type(1, 0, 0); - this->value[1] = col_type(0, 1, 0); - this->value[2] = col_type(0, 0, 1); -# endif - } - - template - GLM_FUNC_QUALIFIER tmat3x3::tmat3x3(ctor) - {} +# if !GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER tmat3x3::tmat3x3() + { +# ifndef GLM_FORCE_NO_CTOR_INIT + this->value[0] = col_type(1, 0, 0); + this->value[1] = col_type(0, 1, 0); + this->value[2] = col_type(0, 0, 1); +# endif + } - template - GLM_FUNC_QUALIFIER tmat3x3::tmat3x3(tmat3x3 const & m) - { - this->value[0] = m.value[0]; - this->value[1] = m.value[1]; - this->value[2] = m.value[2]; - } + template + GLM_FUNC_QUALIFIER tmat3x3::tmat3x3(tmat3x3 const & m) + { + this->value[0] = m.value[0]; + this->value[1] = m.value[1]; + this->value[2] = m.value[2]; + } +# endif//!GLM_HAS_DEFAULTED_FUNCTIONS template template @@ -90,6 +88,10 @@ namespace detail this->value[2] = m.value[2]; } + template + GLM_FUNC_QUALIFIER tmat3x3::tmat3x3(ctor) + {} + template GLM_FUNC_QUALIFIER tmat3x3::tmat3x3(T const & s) { @@ -281,14 +283,16 @@ namespace detail ////////////////////////////////////////////////////////////// // Operators - template - GLM_FUNC_QUALIFIER tmat3x3 & tmat3x3::operator=(tmat3x3 const & m) - { - this->value[0] = m[0]; - this->value[1] = m[1]; - this->value[2] = m[2]; - return *this; - } +# if !GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER tmat3x3 & tmat3x3::operator=(tmat3x3 const & m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + this->value[2] = m[2]; + return *this; + } +# endif//!GLM_HAS_DEFAULTED_FUNCTIONS template template diff --git a/glm/detail/type_mat3x4.hpp b/glm/detail/type_mat3x4.hpp index 12a27820..e058a36c 100644 --- a/glm/detail/type_mat3x4.hpp +++ b/glm/detail/type_mat3x4.hpp @@ -64,8 +64,9 @@ namespace glm public: // Constructors - GLM_FUNC_DECL tmat3x4(); - GLM_FUNC_DECL tmat3x4(tmat3x4 const & m); + + GLM_FUNC_DECL tmat3x4() GLM_DEFAULT; + GLM_FUNC_DECL tmat3x4(tmat3x4 const & m) GLM_DEFAULT; template GLM_FUNC_DECL tmat3x4(tmat3x4 const & m); @@ -132,7 +133,7 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators - GLM_FUNC_DECL tmat3x4 & operator=(tmat3x4 const & m); + GLM_FUNC_DECL tmat3x4 & operator=(tmat3x4 const & m) GLM_DEFAULT; template GLM_FUNC_DECL tmat3x4 & operator=(tmat3x4 const & m); diff --git a/glm/detail/type_mat3x4.inl b/glm/detail/type_mat3x4.inl index 03e0c2cf..ba717a7c 100644 --- a/glm/detail/type_mat3x4.inl +++ b/glm/detail/type_mat3x4.inl @@ -35,23 +35,25 @@ namespace glm ////////////////////////////////////////////////////////////// // Constructors - template - GLM_FUNC_QUALIFIER tmat3x4::tmat3x4() - { -# ifndef GLM_FORCE_NO_CTOR_INIT - this->value[0] = col_type(1, 0, 0, 0); - this->value[1] = col_type(0, 1, 0, 0); - this->value[2] = col_type(0, 0, 1, 0); -# endif - } +# if !GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER tmat3x4::tmat3x4() + { +# ifndef GLM_FORCE_NO_CTOR_INIT + this->value[0] = col_type(1, 0, 0, 0); + this->value[1] = col_type(0, 1, 0, 0); + this->value[2] = col_type(0, 0, 1, 0); +# endif + } - template - GLM_FUNC_QUALIFIER tmat3x4::tmat3x4(tmat3x4 const & m) - { - this->value[0] = m.value[0]; - this->value[1] = m.value[1]; - this->value[2] = m.value[2]; - } + template + GLM_FUNC_QUALIFIER tmat3x4::tmat3x4(tmat3x4 const & m) + { + this->value[0] = m.value[0]; + this->value[1] = m.value[1]; + this->value[2] = m.value[2]; + } +# endif//!GLM_HAS_DEFAULTED_FUNCTIONS template template @@ -103,6 +105,7 @@ namespace glm ////////////////////////////////////// // Conversion constructors + template template < typename X1, typename Y1, typename Z1, typename W1, @@ -256,14 +259,16 @@ namespace glm ////////////////////////////////////////////////////////////// // Unary updatable operators - template - GLM_FUNC_QUALIFIER tmat3x4& tmat3x4::operator=(tmat3x4 const & m) - { - this->value[0] = m[0]; - this->value[1] = m[1]; - this->value[2] = m[2]; - return *this; - } +# if !GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER tmat3x4& tmat3x4::operator=(tmat3x4 const & m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + this->value[2] = m[2]; + return *this; + } +# endif//!GLM_HAS_DEFAULTED_FUNCTIONS template template diff --git a/glm/detail/type_mat4x2.hpp b/glm/detail/type_mat4x2.hpp index 99a1dd74..b213e699 100644 --- a/glm/detail/type_mat4x2.hpp +++ b/glm/detail/type_mat4x2.hpp @@ -64,8 +64,9 @@ namespace glm public: // Constructors - GLM_FUNC_DECL tmat4x2(); - GLM_FUNC_DECL tmat4x2(tmat4x2 const & m); + + GLM_FUNC_DECL tmat4x2() GLM_DEFAULT; + GLM_FUNC_DECL tmat4x2(tmat4x2 const & m) GLM_DEFAULT; template GLM_FUNC_DECL tmat4x2(tmat4x2 const & m); @@ -138,7 +139,7 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators - GLM_FUNC_DECL tmat4x2 & operator=(tmat4x2 const & m); + GLM_FUNC_DECL tmat4x2 & operator=(tmat4x2 const & m) GLM_DEFAULT; template GLM_FUNC_DECL tmat4x2 & operator=(tmat4x2 const & m); diff --git a/glm/detail/type_mat4x2.inl b/glm/detail/type_mat4x2.inl index dac9ff06..8a6b813b 100644 --- a/glm/detail/type_mat4x2.inl +++ b/glm/detail/type_mat4x2.inl @@ -35,25 +35,27 @@ namespace glm ////////////////////////////////////////////////////////////// // Constructors - template - GLM_FUNC_QUALIFIER tmat4x2::tmat4x2() - { -# ifndef GLM_FORCE_NO_CTOR_INIT - this->value[0] = col_type(1, 0); - this->value[1] = col_type(0, 1); - this->value[2] = col_type(0, 0); - this->value[3] = col_type(0, 0); -# endif - } +# if !GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER tmat4x2::tmat4x2() + { +# ifndef GLM_FORCE_NO_CTOR_INIT + this->value[0] = col_type(1, 0); + this->value[1] = col_type(0, 1); + this->value[2] = col_type(0, 0); + this->value[3] = col_type(0, 0); +# endif + } - template - GLM_FUNC_QUALIFIER tmat4x2::tmat4x2(tmat4x2 const & m) - { - this->value[0] = m.value[0]; - this->value[1] = m.value[1]; - this->value[2] = m.value[2]; - this->value[3] = m.value[3]; - } + template + GLM_FUNC_QUALIFIER tmat4x2::tmat4x2(tmat4x2 const & m) + { + this->value[0] = m.value[0]; + this->value[1] = m.value[1]; + this->value[2] = m.value[2]; + this->value[3] = m.value[3]; + } +# endif//!GLM_HAS_DEFAULTED_FUNCTIONS template template @@ -150,6 +152,7 @@ namespace glm ////////////////////////////////////// // Conversion + template template GLM_FUNC_QUALIFIER tmat4x2::tmat4x2(tmat4x2 const & m) @@ -280,15 +283,17 @@ namespace glm ////////////////////////////////////////////////////////////// // Unary updatable operators - template - GLM_FUNC_QUALIFIER tmat4x2& tmat4x2::operator=(tmat4x2 const & m) - { - this->value[0] = m[0]; - this->value[1] = m[1]; - this->value[2] = m[2]; - this->value[3] = m[3]; - return *this; - } +# if !GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER tmat4x2& tmat4x2::operator=(tmat4x2 const & m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + this->value[2] = m[2]; + this->value[3] = m[3]; + return *this; + } +# endif//!GLM_HAS_DEFAULTED_FUNCTIONS template template diff --git a/glm/detail/type_mat4x3.hpp b/glm/detail/type_mat4x3.hpp index a29c7fb2..f6e69956 100644 --- a/glm/detail/type_mat4x3.hpp +++ b/glm/detail/type_mat4x3.hpp @@ -58,13 +58,13 @@ namespace glm # endif//GLM_META_PROG_HELPERS private: - // Data col_type value[4]; public: // Constructors - GLM_FUNC_DECL tmat4x3(); - GLM_FUNC_DECL tmat4x3(tmat4x3 const & m); + + GLM_FUNC_DECL tmat4x3() GLM_DEFAULT; + GLM_FUNC_DECL tmat4x3(tmat4x3 const & m) GLM_DEFAULT; template GLM_FUNC_DECL tmat4x3(tmat4x3 const & m); @@ -137,7 +137,7 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators - GLM_FUNC_DECL tmat4x3 & operator=(tmat4x3 const & m); + GLM_FUNC_DECL tmat4x3 & operator=(tmat4x3 const & m) GLM_DEFAULT; template GLM_FUNC_DECL tmat4x3 & operator=(tmat4x3 const & m); diff --git a/glm/detail/type_mat4x3.inl b/glm/detail/type_mat4x3.inl index d5c62c8a..28847624 100644 --- a/glm/detail/type_mat4x3.inl +++ b/glm/detail/type_mat4x3.inl @@ -35,25 +35,27 @@ namespace glm ////////////////////////////////////////////////////////////// // Constructors - template - GLM_FUNC_QUALIFIER tmat4x3::tmat4x3() - { -# ifndef GLM_FORCE_NO_CTOR_INIT - this->value[0] = col_type(1, 0, 0); - this->value[1] = col_type(0, 1, 0); - this->value[2] = col_type(0, 0, 1); - this->value[3] = col_type(0, 0, 0); -# endif - } +# if !GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER tmat4x3::tmat4x3() + { +# ifndef GLM_FORCE_NO_CTOR_INIT + this->value[0] = col_type(1, 0, 0); + this->value[1] = col_type(0, 1, 0); + this->value[2] = col_type(0, 0, 1); + this->value[3] = col_type(0, 0, 0); +# endif + } - template - GLM_FUNC_QUALIFIER tmat4x3::tmat4x3(tmat4x3 const & m) - { - this->value[0] = m.value[0]; - this->value[1] = m.value[1]; - this->value[2] = m.value[2]; - this->value[3] = m.value[3]; - } + template + GLM_FUNC_QUALIFIER tmat4x3::tmat4x3(tmat4x3 const & m) + { + this->value[0] = m.value[0]; + this->value[1] = m.value[1]; + this->value[2] = m.value[2]; + this->value[3] = m.value[3]; + } +# endif//!GLM_HAS_DEFAULTED_FUNCTIONS template template @@ -280,15 +282,17 @@ namespace glm ////////////////////////////////////////////////////////////// // Unary updatable operators - template - GLM_FUNC_QUALIFIER tmat4x3& tmat4x3::operator=(tmat4x3 const & m) - { - this->value[0] = m[0]; - this->value[1] = m[1]; - this->value[2] = m[2]; - this->value[3] = m[3]; - return *this; - } +# if !GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER tmat4x3& tmat4x3::operator=(tmat4x3 const & m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + this->value[2] = m[2]; + this->value[3] = m[3]; + return *this; + } +# endif//!GLM_HAS_DEFAULTED_FUNCTIONS template template diff --git a/glm/detail/type_mat4x4.hpp b/glm/detail/type_mat4x4.hpp index e8e9bcd4..4cf6791d 100644 --- a/glm/detail/type_mat4x4.hpp +++ b/glm/detail/type_mat4x4.hpp @@ -62,14 +62,12 @@ namespace glm friend tvec4 operator/(tvec4 const & v, tmat4x4 const & m); private: - /// @cond DETAIL col_type value[4]; - /// @endcond public: // Constructors - GLM_FUNC_DECL tmat4x4(); - GLM_FUNC_DECL tmat4x4(tmat4x4 const & m); + GLM_FUNC_DECL tmat4x4() GLM_DEFAULT; + GLM_FUNC_DECL tmat4x4(tmat4x4 const & m) GLM_DEFAULT; template GLM_FUNC_DECL tmat4x4(tmat4x4 const & m); @@ -142,7 +140,7 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators - GLM_FUNC_DECL tmat4x4 & operator=(tmat4x4 const & m); + GLM_FUNC_DECL tmat4x4 & operator=(tmat4x4 const & m) GLM_DEFAULT; template GLM_FUNC_DECL tmat4x4 & operator=(tmat4x4 const & m); diff --git a/glm/detail/type_mat4x4.inl b/glm/detail/type_mat4x4.inl index 103be5b6..a8bd03e5 100644 --- a/glm/detail/type_mat4x4.inl +++ b/glm/detail/type_mat4x4.inl @@ -95,25 +95,27 @@ namespace detail ////////////////////////////////////////////////////////////// // Constructors - template - GLM_FUNC_QUALIFIER tmat4x4::tmat4x4() - { -# ifndef GLM_FORCE_NO_CTOR_INIT - this->value[0] = col_type(1, 0, 0, 0); - this->value[1] = col_type(0, 1, 0, 0); - this->value[2] = col_type(0, 0, 1, 0); - this->value[3] = col_type(0, 0, 0, 1); -# endif - } +# if !GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER tmat4x4::tmat4x4() + { +# ifndef GLM_FORCE_NO_CTOR_INIT + this->value[0] = col_type(1, 0, 0, 0); + this->value[1] = col_type(0, 1, 0, 0); + this->value[2] = col_type(0, 0, 1, 0); + this->value[3] = col_type(0, 0, 0, 1); +# endif + } - template - GLM_FUNC_QUALIFIER tmat4x4::tmat4x4(tmat4x4 const & m) - { - this->value[0] = m[0]; - this->value[1] = m[1]; - this->value[2] = m[2]; - this->value[3] = m[3]; - } + template + GLM_FUNC_QUALIFIER tmat4x4::tmat4x4(tmat4x4 const & m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + this->value[2] = m[2]; + this->value[3] = m[3]; + } +# endif//!GLM_HAS_DEFAULTED_FUNCTIONS template template @@ -246,6 +248,7 @@ namespace detail ////////////////////////////////////// // Matrix convertion constructors + template GLM_FUNC_QUALIFIER tmat4x4::tmat4x4(tmat2x2 const & m) { @@ -366,17 +369,19 @@ namespace detail ////////////////////////////////////////////////////////////// // Operators - template - GLM_FUNC_QUALIFIER tmat4x4& tmat4x4::operator=(tmat4x4 const & m) - { - //memcpy could be faster - //memcpy(&this->value, &m.value, 16 * sizeof(valType)); - this->value[0] = m[0]; - this->value[1] = m[1]; - this->value[2] = m[2]; - this->value[3] = m[3]; - return *this; - } +# if !GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER tmat4x4& tmat4x4::operator=(tmat4x4 const & m) + { + //memcpy could be faster + //memcpy(&this->value, &m.value, 16 * sizeof(valType)); + this->value[0] = m[0]; + this->value[1] = m[1]; + this->value[2] = m[2]; + this->value[3] = m[3]; + return *this; + } +# endif//!GLM_HAS_DEFAULTED_FUNCTIONS template template diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index 07e2f18a..2478c7c7 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -95,8 +95,8 @@ namespace glm ////////////////////////////////////// // Implicit basic constructors - GLM_FUNC_DECL tquat(); - GLM_FUNC_DECL tquat(tquat const & q); + GLM_FUNC_DECL tquat() GLM_DEFAULT; + GLM_FUNC_DECL tquat(tquat const & q) GLM_DEFAULT; template GLM_FUNC_DECL tquat(tquat const & q); @@ -135,7 +135,7 @@ namespace glm ////////////////////////////////////// // Operators - GLM_FUNC_DECL tquat & operator=(tquat const & m); + GLM_FUNC_DECL tquat & operator=(tquat const & m) GLM_DEFAULT; template GLM_FUNC_DECL tquat & operator=(tquat const & m); diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index 33ca82cc..73eab726 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -97,17 +97,19 @@ namespace detail ////////////////////////////////////// // Implicit basic constructors - template - GLM_FUNC_QUALIFIER tquat::tquat() -# ifndef GLM_FORCE_NO_CTOR_INIT - : x(0), y(0), z(0), w(1) -# endif - {} +# if !GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER tquat::tquat() +# ifndef GLM_FORCE_NO_CTOR_INIT + : x(0), y(0), z(0), w(1) +# endif + {} - template - GLM_FUNC_QUALIFIER tquat::tquat(tquat const & q) - : x(q.x), y(q.y), z(q.z), w(q.w) - {} + template + GLM_FUNC_QUALIFIER tquat::tquat(tquat const & q) + : x(q.x), y(q.y), z(q.z), w(q.w) + {} +# endif//!GLM_HAS_DEFAULTED_FUNCTIONS template template @@ -225,15 +227,17 @@ namespace detail ////////////////////////////////////////////////////////////// // tquat operators - template - GLM_FUNC_QUALIFIER tquat & tquat::operator=(tquat const & q) - { - this->w = q.w; - this->x = q.x; - this->y = q.y; - this->z = q.z; - return *this; - } +# if !GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER tquat & tquat::operator=(tquat const & q) + { + this->w = q.w; + this->x = q.x; + this->y = q.y; + this->z = q.z; + return *this; + } +# endif//!GLM_HAS_DEFAULTED_FUNCTIONS template template diff --git a/glm/gtx/dual_quaternion.hpp b/glm/gtx/dual_quaternion.hpp index 624470f4..ad861afd 100644 --- a/glm/gtx/dual_quaternion.hpp +++ b/glm/gtx/dual_quaternion.hpp @@ -94,8 +94,8 @@ namespace glm ////////////////////////////////////// // Implicit basic constructors - GLM_FUNC_DECL tdualquat(); - GLM_FUNC_DECL tdualquat(tdualquat const & d); + GLM_FUNC_DECL tdualquat() GLM_DEFAULT; + GLM_FUNC_DECL tdualquat(tdualquat const & d) GLM_DEFAULT; template GLM_FUNC_DECL tdualquat(tdualquat const & d); @@ -117,7 +117,7 @@ namespace glm GLM_FUNC_DECL explicit tdualquat(tmat3x4 const & aug_mat); // Operators - GLM_FUNC_DECL tdualquat & operator=(tdualquat const & m); + GLM_FUNC_DECL tdualquat & operator=(tdualquat const & m) GLM_DEFAULT; template GLM_FUNC_DECL tdualquat & operator=(tdualquat const & m); diff --git a/glm/gtx/dual_quaternion.inl b/glm/gtx/dual_quaternion.inl index 8fed0855..7d2ed2ac 100644 --- a/glm/gtx/dual_quaternion.inl +++ b/glm/gtx/dual_quaternion.inl @@ -83,19 +83,21 @@ namespace glm ////////////////////////////////////// // Implicit basic constructors - template - GLM_FUNC_QUALIFIER tdualquat::tdualquat() -# ifndef GLM_FORCE_NO_CTOR_INIT - : real(tquat()) - , dual(tquat(0, 0, 0, 0)) -# endif - {} +# if !GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER tdualquat::tdualquat() +# ifndef GLM_FORCE_NO_CTOR_INIT + : real(tquat()) + , dual(tquat(0, 0, 0, 0)) +# endif + {} - template - GLM_FUNC_QUALIFIER tdualquat::tdualquat(tdualquat const & d) - : real(d.real) - , dual(d.dual) - {} + template + GLM_FUNC_QUALIFIER tdualquat::tdualquat(tdualquat const & d) + : real(d.real) + , dual(d.dual) + {} +# endif//!GLM_HAS_DEFAULTED_FUNCTIONS template template @@ -155,13 +157,15 @@ namespace glm ////////////////////////////////////////////////////////////// // tdualquat operators - template - GLM_FUNC_QUALIFIER tdualquat & tdualquat::operator=(tdualquat const & q) - { - this->real = q.real; - this->dual = q.dual; - return *this; - } +# if !GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER tdualquat & tdualquat::operator=(tdualquat const & q) + { + this->real = q.real; + this->dual = q.dual; + return *this; + } +# endif//!GLM_HAS_DEFAULTED_FUNCTIONS template template diff --git a/readme.md b/readme.md index 65b46f57..444e2870 100644 --- a/readme.md +++ b/readme.md @@ -60,6 +60,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate) - Added for texcoord wrapping - Added static components and precision members to all vector and quat types #350 - Added .gitignore #349 +- Added support of defaulted functions to GLM types, to use them in unions #366 ##### Improvements: - Changed usage of __has_include to support Intel compiler #307 diff --git a/test/core/core_type_mat2x2.cpp b/test/core/core_type_mat2x2.cpp index ea5145ca..93ce7186 100644 --- a/test/core/core_type_mat2x2.cpp +++ b/test/core/core_type_mat2x2.cpp @@ -82,6 +82,22 @@ int test_ctr() { int Error(0); +# if GLM_HAS_DEFAULTED_FUNCTIONS + { + union pack + { + glm::mat2x2 f; + glm::mat2x2 i; + } A, B; + + A.f = glm::mat2x2(0); + Error += glm::all(glm::equal(A.i[0], glm::vec2(0))) ? 0 : 1; + + B.f = glm::mat2x2(1); + Error += glm::all(glm::equal(B.i[0], glm::vec2(1, 0))) ? 0 : 1; + } +# endif//GLM_HAS_DEFAULTED_FUNCTIONS + #if GLM_HAS_INITIALIZER_LISTS glm::mat2x2 m0( glm::vec2(0, 1), diff --git a/test/core/core_type_mat2x3.cpp b/test/core/core_type_mat2x3.cpp index 45cad31b..a213e11f 100644 --- a/test/core/core_type_mat2x3.cpp +++ b/test/core/core_type_mat2x3.cpp @@ -55,7 +55,23 @@ static int test_operators() int test_ctr() { int Error(0); - + +# if GLM_HAS_DEFAULTED_FUNCTIONS + { + union pack + { + glm::mat2x3 f; + glm::mat2x3 i; + } A, B; + + A.f = glm::mat2x3(0); + Error += glm::all(glm::equal(A.i[0], glm::vec3(0))) ? 0 : 1; + + B.f = glm::mat2x3(1); + Error += glm::all(glm::equal(B.i[0], glm::vec3(1, 0, 0))) ? 0 : 1; + } +# endif//GLM_HAS_DEFAULTED_FUNCTIONS + #if GLM_HAS_INITIALIZER_LISTS glm::mat2x3 m0( glm::vec3(0, 1, 2), diff --git a/test/core/core_type_mat2x4.cpp b/test/core/core_type_mat2x4.cpp index 4811ee09..a9f1b97f 100644 --- a/test/core/core_type_mat2x4.cpp +++ b/test/core/core_type_mat2x4.cpp @@ -55,7 +55,23 @@ static int test_operators() int test_ctr() { int Error(0); - + +# if GLM_HAS_DEFAULTED_FUNCTIONS + { + union pack + { + glm::mat2x4 f; + glm::mat2x4 i; + } A, B; + + A.f = glm::mat2x4(0); + Error += glm::all(glm::equal(A.i[0], glm::vec4(0))) ? 0 : 1; + + B.f = glm::mat2x4(1); + Error += glm::all(glm::equal(B.i[0], glm::vec4(1, 0, 0, 0))) ? 0 : 1; + } +# endif//GLM_HAS_DEFAULTED_FUNCTIONS + #if(GLM_HAS_INITIALIZER_LISTS) glm::mat2x4 m0( glm::vec4(0, 1, 2, 3), diff --git a/test/core/core_type_mat3x2.cpp b/test/core/core_type_mat3x2.cpp index a1b631e6..fdfab3c3 100644 --- a/test/core/core_type_mat3x2.cpp +++ b/test/core/core_type_mat3x2.cpp @@ -55,7 +55,23 @@ static bool test_operators() int test_ctr() { int Error(0); - + +# if GLM_HAS_DEFAULTED_FUNCTIONS + { + union pack + { + glm::mat3x2 f; + glm::mat3x2 i; + } A, B; + + A.f = glm::mat3x2(0); + Error += glm::all(glm::equal(A.i[0], glm::vec2(0))) ? 0 : 1; + + B.f = glm::mat3x2(1); + Error += glm::all(glm::equal(B.i[0], glm::vec2(1, 0))) ? 0 : 1; + } +# endif//GLM_HAS_DEFAULTED_FUNCTIONS + #if(GLM_HAS_INITIALIZER_LISTS) glm::mat3x2 m0( glm::vec2(0, 1), diff --git a/test/core/core_type_mat3x3.cpp b/test/core/core_type_mat3x3.cpp index d4d5f3a0..943c4364 100644 --- a/test/core/core_type_mat3x3.cpp +++ b/test/core/core_type_mat3x3.cpp @@ -114,7 +114,23 @@ int test_inverse() int test_ctr() { int Error(0); - + +# if GLM_HAS_DEFAULTED_FUNCTIONS + { + union pack + { + glm::mat3x3 f; + glm::mat3x3 i; + } A, B; + + A.f = glm::mat3x3(0); + Error += glm::all(glm::equal(A.i[0], glm::vec3(0))) ? 0 : 1; + + B.f = glm::mat3x3(1); + Error += glm::all(glm::equal(B.i[0], glm::vec3(1, 0, 0))) ? 0 : 1; + } +# endif//GLM_HAS_DEFAULTED_FUNCTIONS + #if(GLM_HAS_INITIALIZER_LISTS) glm::mat3x3 m0( glm::vec3(0, 1, 2), diff --git a/test/core/core_type_mat3x4.cpp b/test/core/core_type_mat3x4.cpp index 0b29887a..3ec5c9f3 100644 --- a/test/core/core_type_mat3x4.cpp +++ b/test/core/core_type_mat3x4.cpp @@ -55,7 +55,23 @@ static bool test_operators() int test_ctr() { int Error(0); - + +# if GLM_HAS_DEFAULTED_FUNCTIONS + { + union pack + { + glm::mat3x4 f; + glm::mat3x4 i; + } A, B; + + A.f = glm::mat3x4(0); + Error += glm::all(glm::equal(A.i[0], glm::vec4(0))) ? 0 : 1; + + B.f = glm::mat3x4(1); + Error += glm::all(glm::equal(B.i[0], glm::vec4(1, 0, 0, 0))) ? 0 : 1; + } +# endif//GLM_HAS_DEFAULTED_FUNCTIONS + #if(GLM_HAS_INITIALIZER_LISTS) glm::mat3x4 m0( glm::vec4(0, 1, 2, 3), diff --git a/test/core/core_type_mat4x2.cpp b/test/core/core_type_mat4x2.cpp index 13bea3f6..ec71d179 100644 --- a/test/core/core_type_mat4x2.cpp +++ b/test/core/core_type_mat4x2.cpp @@ -56,6 +56,22 @@ int test_ctr() { int Error(0); +# if GLM_HAS_DEFAULTED_FUNCTIONS + { + union pack + { + glm::mat4x2 f; + glm::mat4x2 i; + } A, B; + + A.f = glm::mat4x2(0); + Error += glm::all(glm::equal(A.i[0], glm::vec2(0))) ? 0 : 1; + + B.f = glm::mat4x2(1); + Error += glm::all(glm::equal(B.i[0], glm::vec2(1, 0))) ? 0 : 1; + } +# endif//GLM_HAS_DEFAULTED_FUNCTIONS + #if(GLM_HAS_INITIALIZER_LISTS) glm::mat4x2 m0( glm::vec2(0, 1), diff --git a/test/core/core_type_mat4x3.cpp b/test/core/core_type_mat4x3.cpp index a91f7e25..99e1f009 100644 --- a/test/core/core_type_mat4x3.cpp +++ b/test/core/core_type_mat4x3.cpp @@ -56,6 +56,22 @@ int test_ctr() { int Error(0); +# if GLM_HAS_DEFAULTED_FUNCTIONS + { + union pack + { + glm::mat4x3 f; + glm::mat4x3 i; + } A, B; + + A.f = glm::mat4x3(0); + Error += glm::all(glm::equal(A.i[0], glm::vec3(0))) ? 0 : 1; + + B.f = glm::mat4x3(1); + Error += glm::all(glm::equal(B.i[0], glm::vec3(1, 0, 0))) ? 0 : 1; + } +# endif//GLM_HAS_DEFAULTED_FUNCTIONS + #if(GLM_HAS_INITIALIZER_LISTS) glm::mat4x3 m0( glm::vec3(0, 1, 2), diff --git a/test/core/core_type_mat4x4.cpp b/test/core/core_type_mat4x4.cpp index c37f2deb..f9264c4d 100644 --- a/test/core/core_type_mat4x4.cpp +++ b/test/core/core_type_mat4x4.cpp @@ -203,6 +203,22 @@ int test_ctr() { int Error(0); +# if GLM_HAS_DEFAULTED_FUNCTIONS + { + union pack + { + glm::mat4 f; + glm::mat4 i; + } A, B; + + A.f = glm::mat4(0); + Error += glm::all(glm::equal(A.i[0], glm::vec4(0))) ? 0 : 1; + + B.f = glm::mat4(1); + Error += glm::all(glm::equal(B.i[0], glm::vec4(1, 0, 0, 0))) ? 0 : 1; + } +# endif//GLM_HAS_DEFAULTED_FUNCTIONS + #if GLM_HAS_TRIVIAL_QUERIES //Error += std::is_trivially_default_constructible::value ? 0 : 1; //Error += std::is_trivially_copy_assignable::value ? 0 : 1; diff --git a/test/gtc/gtc_quaternion.cpp b/test/gtc/gtc_quaternion.cpp index d9b3ddf1..9406003d 100644 --- a/test/gtc/gtc_quaternion.cpp +++ b/test/gtc/gtc_quaternion.cpp @@ -296,6 +296,22 @@ int test_quat_ctr() { int Error(0); +# if GLM_HAS_DEFAULTED_FUNCTIONS + { + union pack + { + glm::quat f; + glm::quat i; + } A, B; + + A.f = glm::quat(0, 0, 0, 0); + Error += glm::all(glm::equal(A.i, glm::quat(0, 0, 0, 0))) ? 0 : 1; + + B.f = glm::quat(1, 1, 1, 1); + Error += glm::all(glm::equal(B.i, glm::quat(1, 1, 1, 1))) ? 0 : 1; + } +# endif//GLM_HAS_DEFAULTED_FUNCTIONS + # if GLM_HAS_TRIVIAL_QUERIES // Error += std::is_trivially_default_constructible::value ? 0 : 1; // Error += std::is_trivially_default_constructible::value ? 0 : 1;