From 6d302792ab849193aaeaec27b0ef1460484a974b Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Thu, 5 May 2016 15:06:03 +0200 Subject: [PATCH] - Added constexpr for *vec*, *mat*, *quat* and *dual_quat* types #493 --- glm/detail/setup.hpp | 14 ++++++++------ glm/detail/type_mat2x2.hpp | 2 +- glm/detail/type_mat2x2.inl | 2 +- glm/detail/type_mat2x3.hpp | 2 +- glm/detail/type_mat2x3.inl | 2 +- glm/detail/type_mat2x4.hpp | 2 +- glm/detail/type_mat2x4.inl | 2 +- glm/detail/type_mat3x2.hpp | 2 +- glm/detail/type_mat3x2.inl | 2 +- glm/detail/type_mat3x3.hpp | 2 +- glm/detail/type_mat3x3.inl | 2 +- glm/detail/type_mat3x4.hpp | 2 +- glm/detail/type_mat3x4.inl | 2 +- glm/detail/type_mat4x2.hpp | 2 +- glm/detail/type_mat4x2.inl | 2 +- glm/detail/type_mat4x3.hpp | 4 ++-- glm/detail/type_mat4x3.inl | 2 +- glm/detail/type_mat4x4.hpp | 2 +- glm/detail/type_mat4x4.inl | 2 +- glm/detail/type_vec1.hpp | 2 +- glm/detail/type_vec1.inl | 2 +- glm/detail/type_vec2.hpp | 2 +- glm/detail/type_vec2.inl | 2 +- glm/detail/type_vec3.hpp | 2 +- glm/detail/type_vec3.inl | 2 +- glm/detail/type_vec4.hpp | 2 +- glm/detail/type_vec4.inl | 2 +- glm/gtc/quaternion.hpp | 2 +- glm/gtc/quaternion.inl | 2 +- 29 files changed, 37 insertions(+), 35 deletions(-) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 4bae9150..61a4ff45 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -723,15 +723,17 @@ # define GLM_DEFAULT_CTOR #endif -#if GLM_HAS_CONSTEXPR_PARTIAL +#if GLM_HAS_CONSTEXPR # define GLM_CONSTEXPR constexpr +# define GLM_CONSTEXPR_CTOR constexpr +# define GLM_RELAXED_CONSTEXPR constexpr +#elif GLM_HAS_CONSTEXPR_PARTIAL +# define GLM_CONSTEXPR constexpr +# define GLM_CONSTEXPR_CTOR +# define GLM_RELAXED_CONSTEXPR const #else # define GLM_CONSTEXPR -#endif - -#if GLM_HAS_CONSTEXPR -# define GLM_RELAXED_CONSTEXPR constexpr -#else +# define GLM_CONSTEXPR_CTOR # define GLM_RELAXED_CONSTEXPR const #endif diff --git a/glm/detail/type_mat2x2.hpp b/glm/detail/type_mat2x2.hpp index 5505ffe5..f188b4d0 100644 --- a/glm/detail/type_mat2x2.hpp +++ b/glm/detail/type_mat2x2.hpp @@ -60,7 +60,7 @@ namespace glm template GLM_FUNC_DECL tmat2x2(tmat2x2 const & m); - GLM_FUNC_DECL GLM_CONSTEXPR explicit tmat2x2(ctor); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tmat2x2(ctor); GLM_FUNC_DECL explicit tmat2x2(T scalar); GLM_FUNC_DECL tmat2x2( T const & x1, T const & y1, diff --git a/glm/detail/type_mat2x2.inl b/glm/detail/type_mat2x2.inl index da426ebb..c1eb176a 100644 --- a/glm/detail/type_mat2x2.inl +++ b/glm/detail/type_mat2x2.inl @@ -81,7 +81,7 @@ namespace detail } template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat2x2::tmat2x2(ctor) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tmat2x2::tmat2x2(ctor) {} template diff --git a/glm/detail/type_mat2x3.hpp b/glm/detail/type_mat2x3.hpp index cccdb6cd..0eaf454b 100644 --- a/glm/detail/type_mat2x3.hpp +++ b/glm/detail/type_mat2x3.hpp @@ -61,7 +61,7 @@ namespace glm template GLM_FUNC_DECL tmat2x3(tmat2x3 const & m); - GLM_FUNC_DECL GLM_CONSTEXPR explicit tmat2x3(ctor); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tmat2x3(ctor); GLM_FUNC_DECL explicit tmat2x3(T scalar); GLM_FUNC_DECL tmat2x3( T x0, T y0, T z0, diff --git a/glm/detail/type_mat2x3.inl b/glm/detail/type_mat2x3.inl index 620716af..3af09be1 100644 --- a/glm/detail/type_mat2x3.inl +++ b/glm/detail/type_mat2x3.inl @@ -63,7 +63,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat2x3::tmat2x3(ctor) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tmat2x3::tmat2x3(ctor) {} template diff --git a/glm/detail/type_mat2x4.hpp b/glm/detail/type_mat2x4.hpp index 51cd965d..ef8f4af9 100644 --- a/glm/detail/type_mat2x4.hpp +++ b/glm/detail/type_mat2x4.hpp @@ -61,7 +61,7 @@ namespace glm template GLM_FUNC_DECL tmat2x4(tmat2x4 const & m); - GLM_FUNC_DECL GLM_CONSTEXPR explicit tmat2x4(ctor); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tmat2x4(ctor); GLM_FUNC_DECL explicit tmat2x4(T scalar); GLM_FUNC_DECL tmat2x4( T x0, T y0, T z0, T w0, diff --git a/glm/detail/type_mat2x4.inl b/glm/detail/type_mat2x4.inl index 99ac7f54..3542443d 100644 --- a/glm/detail/type_mat2x4.inl +++ b/glm/detail/type_mat2x4.inl @@ -63,7 +63,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat2x4::tmat2x4(ctor) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tmat2x4::tmat2x4(ctor) {} template diff --git a/glm/detail/type_mat3x2.hpp b/glm/detail/type_mat3x2.hpp index 73470d15..8158f776 100644 --- a/glm/detail/type_mat3x2.hpp +++ b/glm/detail/type_mat3x2.hpp @@ -61,7 +61,7 @@ namespace glm template GLM_FUNC_DECL tmat3x2(tmat3x2 const & m); - GLM_FUNC_DECL GLM_CONSTEXPR explicit tmat3x2(ctor); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tmat3x2(ctor); GLM_FUNC_DECL explicit tmat3x2(T scalar); GLM_FUNC_DECL tmat3x2( T x0, T y0, diff --git a/glm/detail/type_mat3x2.inl b/glm/detail/type_mat3x2.inl index 4a9dc7ee..a64bfc51 100644 --- a/glm/detail/type_mat3x2.inl +++ b/glm/detail/type_mat3x2.inl @@ -66,7 +66,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat3x2::tmat3x2(ctor) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tmat3x2::tmat3x2(ctor) {} template diff --git a/glm/detail/type_mat3x3.hpp b/glm/detail/type_mat3x3.hpp index e6279678..4eb5cd77 100644 --- a/glm/detail/type_mat3x3.hpp +++ b/glm/detail/type_mat3x3.hpp @@ -60,7 +60,7 @@ namespace glm template GLM_FUNC_DECL tmat3x3(tmat3x3 const & m); - GLM_FUNC_DECL GLM_CONSTEXPR explicit tmat3x3(ctor); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tmat3x3(ctor); GLM_FUNC_DECL explicit tmat3x3(T scalar); GLM_FUNC_DECL tmat3x3( T x0, T y0, T z0, diff --git a/glm/detail/type_mat3x3.inl b/glm/detail/type_mat3x3.inl index e77655ee..917d6a88 100644 --- a/glm/detail/type_mat3x3.inl +++ b/glm/detail/type_mat3x3.inl @@ -90,7 +90,7 @@ namespace detail } template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat3x3::tmat3x3(ctor) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tmat3x3::tmat3x3(ctor) {} template diff --git a/glm/detail/type_mat3x4.hpp b/glm/detail/type_mat3x4.hpp index 8cf67945..4778b8fc 100644 --- a/glm/detail/type_mat3x4.hpp +++ b/glm/detail/type_mat3x4.hpp @@ -61,7 +61,7 @@ namespace glm template GLM_FUNC_DECL tmat3x4(tmat3x4 const & m); - GLM_FUNC_DECL GLM_CONSTEXPR explicit tmat3x4(ctor); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tmat3x4(ctor); GLM_FUNC_DECL explicit tmat3x4(T scalar); GLM_FUNC_DECL tmat3x4( T x0, T y0, T z0, T w0, diff --git a/glm/detail/type_mat3x4.inl b/glm/detail/type_mat3x4.inl index 86806010..827c327c 100644 --- a/glm/detail/type_mat3x4.inl +++ b/glm/detail/type_mat3x4.inl @@ -66,7 +66,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat3x4::tmat3x4(ctor) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tmat3x4::tmat3x4(ctor) {} template diff --git a/glm/detail/type_mat4x2.hpp b/glm/detail/type_mat4x2.hpp index 1a6d3593..a8cd0f30 100644 --- a/glm/detail/type_mat4x2.hpp +++ b/glm/detail/type_mat4x2.hpp @@ -61,7 +61,7 @@ namespace glm template GLM_FUNC_DECL tmat4x2(tmat4x2 const & m); - GLM_FUNC_DECL GLM_CONSTEXPR explicit tmat4x2(ctor); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tmat4x2(ctor); GLM_FUNC_DECL explicit tmat4x2(T scalar); GLM_FUNC_DECL tmat4x2( T x0, T y0, diff --git a/glm/detail/type_mat4x2.inl b/glm/detail/type_mat4x2.inl index 1cccb9e0..f374984e 100644 --- a/glm/detail/type_mat4x2.inl +++ b/glm/detail/type_mat4x2.inl @@ -76,7 +76,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat4x2::tmat4x2(ctor) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tmat4x2::tmat4x2(ctor) {} template diff --git a/glm/detail/type_mat4x3.hpp b/glm/detail/type_mat4x3.hpp index 15ec39a1..7aae7bdd 100644 --- a/glm/detail/type_mat4x3.hpp +++ b/glm/detail/type_mat4x3.hpp @@ -57,11 +57,11 @@ namespace glm // -- Constructors -- GLM_FUNC_DECL tmat4x3() GLM_DEFAULT_CTOR; - GLM_FUNC_DECL GLM_CONSTEXPR tmat4x3(tmat4x3 const & m) GLM_DEFAULT; + GLM_FUNC_DECL tmat4x3(tmat4x3 const & m) GLM_DEFAULT; template GLM_FUNC_DECL tmat4x3(tmat4x3 const & m); - GLM_FUNC_DECL GLM_CONSTEXPR explicit tmat4x3(ctor); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tmat4x3(ctor); GLM_FUNC_DECL explicit tmat4x3(T const & x); GLM_FUNC_DECL tmat4x3( T const & x0, T const & y0, T const & z0, diff --git a/glm/detail/type_mat4x3.inl b/glm/detail/type_mat4x3.inl index d285c6ef..da118ff1 100644 --- a/glm/detail/type_mat4x3.inl +++ b/glm/detail/type_mat4x3.inl @@ -69,7 +69,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat4x3::tmat4x3(ctor) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tmat4x3::tmat4x3(ctor) {} template diff --git a/glm/detail/type_mat4x4.hpp b/glm/detail/type_mat4x4.hpp index 2e4c794e..84362fa0 100644 --- a/glm/detail/type_mat4x4.hpp +++ b/glm/detail/type_mat4x4.hpp @@ -60,7 +60,7 @@ namespace glm template GLM_FUNC_DECL tmat4x4(tmat4x4 const & m); - GLM_FUNC_DECL GLM_CONSTEXPR explicit tmat4x4(ctor); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tmat4x4(ctor); GLM_FUNC_DECL explicit tmat4x4(T const & x); GLM_FUNC_DECL tmat4x4( T const & x0, T const & y0, T const & z0, T const & w0, diff --git a/glm/detail/type_mat4x4.inl b/glm/detail/type_mat4x4.inl index 09685a3f..27231863 100644 --- a/glm/detail/type_mat4x4.inl +++ b/glm/detail/type_mat4x4.inl @@ -129,7 +129,7 @@ namespace detail } template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat4x4::tmat4x4(ctor) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tmat4x4::tmat4x4(ctor) {} template diff --git a/glm/detail/type_vec1.hpp b/glm/detail/type_vec1.hpp index 1ee2a4b2..014c836e 100644 --- a/glm/detail/type_vec1.hpp +++ b/glm/detail/type_vec1.hpp @@ -101,7 +101,7 @@ namespace glm // -- Explicit basic constructors -- - GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec1(ctor); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tvec1(ctor); GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec1(T scalar); // -- Conversion vector constructors -- diff --git a/glm/detail/type_vec1.inl b/glm/detail/type_vec1.inl index 23ee0ff8..b70603ff 100644 --- a/glm/detail/type_vec1.inl +++ b/glm/detail/type_vec1.inl @@ -59,7 +59,7 @@ namespace glm // -- Explicit basic constructors -- template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec1::tvec1(ctor) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec1::tvec1(ctor) {} template diff --git a/glm/detail/type_vec2.hpp b/glm/detail/type_vec2.hpp index 84f05add..6dc2fd42 100644 --- a/glm/detail/type_vec2.hpp +++ b/glm/detail/type_vec2.hpp @@ -101,7 +101,7 @@ namespace glm // -- Explicit basic constructors -- - GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec2(ctor); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tvec2(ctor); GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec2(T scalar); GLM_FUNC_DECL GLM_CONSTEXPR tvec2(T s1, T s2); diff --git a/glm/detail/type_vec2.inl b/glm/detail/type_vec2.inl index 0c5b8f1c..0868a895 100644 --- a/glm/detail/type_vec2.inl +++ b/glm/detail/type_vec2.inl @@ -68,7 +68,7 @@ namespace glm // -- Explicit basic constructors -- template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2::tvec2(ctor) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec2::tvec2(ctor) {} template diff --git a/glm/detail/type_vec3.hpp b/glm/detail/type_vec3.hpp index 5c3829ff..c7e96230 100644 --- a/glm/detail/type_vec3.hpp +++ b/glm/detail/type_vec3.hpp @@ -102,7 +102,7 @@ namespace glm // -- Explicit basic constructors -- - GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec3(ctor); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tvec3(ctor); GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec3(T scalar); GLM_FUNC_DECL GLM_CONSTEXPR tvec3(T a, T b, T c); diff --git a/glm/detail/type_vec3.inl b/glm/detail/type_vec3.inl index fbb9ab08..54c79141 100644 --- a/glm/detail/type_vec3.inl +++ b/glm/detail/type_vec3.inl @@ -85,7 +85,7 @@ namespace glm // -- Explicit basic constructors -- template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec3::tvec3(ctor) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec3::tvec3(ctor) {} template diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index 0be564d7..808a0a10 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -157,7 +157,7 @@ namespace detail // -- Explicit basic constructors -- - GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec4(ctor); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tvec4(ctor); GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec4(T scalar); GLM_FUNC_DECL GLM_CONSTEXPR tvec4(T a, T b, T c, T d); diff --git a/glm/detail/type_vec4.inl b/glm/detail/type_vec4.inl index 1694e8a4..3e44daaf 100644 --- a/glm/detail/type_vec4.inl +++ b/glm/detail/type_vec4.inl @@ -59,7 +59,7 @@ namespace glm // -- Explicit basic constructors -- template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec4::tvec4(ctor) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(ctor) {} template diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index 97abe5a0..c839752f 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -89,7 +89,7 @@ namespace glm // -- Explicit basic constructors -- - GLM_FUNC_DECL GLM_CONSTEXPR explicit tquat(ctor); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tquat(ctor); GLM_FUNC_DECL GLM_CONSTEXPR tquat(T const & s, tvec3 const & v); GLM_FUNC_DECL GLM_CONSTEXPR tquat(T const & w, T const & x, T const & y, T const & z); diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index 7c9fc611..581b672e 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -98,7 +98,7 @@ namespace detail // -- Explicit basic constructors -- template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat::tquat(ctor) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tquat::tquat(ctor) {} template