Browse Source

- Added constexpr for *vec*, *mat*, *quat* and *dual_quat* types #493

Christophe Riccio 9 years ago
parent
commit
d52766297d
4 changed files with 10 additions and 6 deletions
  1. 6 2
      glm/detail/setup.hpp
  2. 1 1
      glm/detail/type_mat4x3.hpp
  3. 1 1
      glm/gtc/quaternion.inl
  4. 2 2
      glm/gtx/dual_quaternion.inl

+ 6 - 2
glm/detail/setup.hpp

@@ -723,11 +723,15 @@
 #	define GLM_DEFAULT_CTOR
 #endif
 
-#if GLM_HAS_CONSTEXPR
+#if GLM_HAS_CONSTEXPR_PARTIAL
 #	define GLM_CONSTEXPR constexpr
-#	define GLM_RELAXED_CONSTEXPR constexpr
 #else
 #	define GLM_CONSTEXPR
+#endif
+
+#if GLM_HAS_CONSTEXPR
+#	define GLM_RELAXED_CONSTEXPR constexpr
+#else
 #	define GLM_RELAXED_CONSTEXPR const
 #endif
 

+ 1 - 1
glm/detail/type_mat4x3.hpp

@@ -61,7 +61,7 @@ namespace glm
 		template <precision Q>
 		GLM_FUNC_DECL tmat4x3(tmat4x3<T, Q> const & m);
 
-		GLM_FUNC_DECL explicit tmat4x3(ctor);
+		GLM_FUNC_DECL GLM_CONSTEXPR explicit tmat4x3(ctor);
 		GLM_FUNC_DECL explicit tmat4x3(T const & x);
 		GLM_FUNC_DECL tmat4x3(
 			T const & x0, T const & y0, T const & z0,

+ 1 - 1
glm/gtc/quaternion.inl

@@ -75,7 +75,7 @@ namespace detail
 
 #	if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)
 		template <typename T, precision P>
-		GLM_FUNC_QUALIFIER tquat<T, P>::tquat()
+		GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, P>::tquat()
 #			ifndef GLM_FORCE_NO_CTOR_INIT
 				: x(0), y(0), z(0), w(1)
 #			endif

+ 2 - 2
glm/gtx/dual_quaternion.inl

@@ -61,7 +61,7 @@ namespace glm
 
 #	if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)
 		template <typename T, precision P>
-		GLM_FUNC_QUALIFIER tdualquat<T, P>::tdualquat()
+		GLM_FUNC_QUALIFIER GLM_CONSTEXPR tdualquat<T, P>::tdualquat()
 #			ifndef GLM_FORCE_NO_CTOR_INIT 
 				: real(tquat<T, P>())
 				, dual(tquat<T, P>(0, 0, 0, 0))
@@ -71,7 +71,7 @@ namespace glm
 
 #	if !GLM_HAS_DEFAULTED_FUNCTIONS
 		template <typename T, precision P>
-		GLM_FUNC_QUALIFIER tdualquat<T, P>::tdualquat(tdualquat<T, P> const & d)
+		GLM_FUNC_QUALIFIER GLM_CONSTEXPR tdualquat<T, P>::tdualquat(tdualquat<T, P> const & d)
 			: real(d.real)
 			, dual(d.dual)
 		{}