Browse Source

Simplify GLM_FORCE_EXPLICIT_CTOR declarations

- Instead of wrapping the declarations, use a macro for the keyword "explicit"
Jesse Talavera-Greenberg 10 years ago
parent
commit
9cc7dc1763

+ 2 - 7
glm/detail/type_mat2x2.hpp

@@ -98,13 +98,8 @@ namespace glm
 		//////////////////////////////////////
 		// Matrix conversions
 
-#		ifdef GLM_FORCE_EXPLICIT_CTOR
-			template <typename U, precision Q>
-			GLM_FUNC_DECL explicit tmat2x2(tmat2x2<U, Q> const & m);
-#		else
-			template <typename U, precision Q>
-			GLM_FUNC_DECL tmat2x2(tmat2x2<U, Q> const & m);
-#		endif
+		template <typename U, precision Q>
+		GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tmat2x2(tmat2x2<U, Q> const & m);
 
 		GLM_FUNC_DECL explicit tmat2x2(tmat3x3<T, P> const & x);
 		GLM_FUNC_DECL explicit tmat2x2(tmat4x4<T, P> const & x);

+ 2 - 7
glm/detail/type_mat2x3.hpp

@@ -94,13 +94,8 @@ namespace glm
 		//////////////////////////////////////
 		// Matrix conversion
 
-#		ifdef GLM_FORCE_EXPLICIT_CTOR
-			template <typename U, precision Q>
-			GLM_FUNC_DECL explicit tmat2x3(tmat2x3<U, Q> const & m);
-#		else
-			template <typename U, precision Q>
-			GLM_FUNC_DECL tmat2x3(tmat2x3<U, Q> const & m);
-#		endif
+		template <typename U, precision Q>
+		GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tmat2x3(tmat2x3<U, Q> const & m);
 
 		GLM_FUNC_DECL explicit tmat2x3(tmat2x2<T, P> const & x);
 		GLM_FUNC_DECL explicit tmat2x3(tmat3x3<T, P> const & x);

+ 2 - 7
glm/detail/type_mat2x4.hpp

@@ -95,13 +95,8 @@ namespace glm
 		//////////////////////////////////////
 		// Matrix conversions
 
-#		ifdef GLM_FORCE_EXPLICIT_CTOR
-			template <typename U, precision Q>
-			GLM_FUNC_DECL explicit tmat2x4(tmat2x4<U, Q> const & m);
-#		else
-			template <typename U, precision Q>
-			GLM_FUNC_DECL tmat2x4(tmat2x4<U, Q> const & m);
-#		endif
+		template <typename U, precision Q>
+		GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tmat2x4(tmat2x4<U, Q> const & m);
 
 		GLM_FUNC_DECL explicit tmat2x4(tmat2x2<T, P> const & x);
 		GLM_FUNC_DECL explicit tmat2x4(tmat3x3<T, P> const & x);

+ 2 - 7
glm/detail/type_mat3x2.hpp

@@ -101,13 +101,8 @@ namespace glm
 		//////////////////////////////////////
 		// Matrix conversions
 
-#		ifdef GLM_FORCE_EXPLICIT_CTOR
-			template <typename U, precision Q>
-			GLM_FUNC_DECL explicit tmat3x2(tmat3x2<U, Q> const & m);
-#		else
-			template <typename U, precision Q>
-			GLM_FUNC_DECL tmat3x2(tmat3x2<U, Q> const & m);
-#		endif
+		template <typename U, precision Q>
+		GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tmat3x2(tmat3x2<U, Q> const & m);
 
 		GLM_FUNC_DECL explicit tmat3x2(tmat2x2<T, P> const & x);
 		GLM_FUNC_DECL explicit tmat3x2(tmat3x3<T, P> const & x);

+ 2 - 7
glm/detail/type_mat3x3.hpp

@@ -105,13 +105,8 @@ namespace glm
 		//////////////////////////////////////
 		// Matrix conversions
 
-#		ifdef GLM_FORCE_EXPLICIT_CTOR
-			template <typename U, precision Q>
-			GLM_FUNC_DECL explicit tmat3x3(tmat3x3<U, Q> const & m);
-#		else
-			template <typename U, precision Q>
-			GLM_FUNC_DECL tmat3x3(tmat3x3<U, Q> const & m);
-#		endif
+		template <typename U, precision Q>
+		GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tmat3x3(tmat3x3<U, Q> const & m);
 
 		GLM_FUNC_DECL explicit tmat3x3(tmat2x2<T, P> const & x);
 		GLM_FUNC_DECL explicit tmat3x3(tmat4x4<T, P> const & x);

+ 2 - 7
glm/detail/type_mat3x4.hpp

@@ -100,13 +100,8 @@ namespace glm
 		//////////////////////////////////////
 		// Matrix conversion
 
-#		ifdef GLM_FORCE_EXPLICIT_CTOR
-			template <typename U, precision Q>
-			GLM_FUNC_DECL explicit tmat3x4(tmat3x4<U, Q> const & m);
-#		else
-			template <typename U, precision Q>
-			GLM_FUNC_DECL tmat3x4(tmat3x4<U, Q> const & m);
-#		endif
+		template <typename U, precision Q>
+		GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tmat3x4(tmat3x4<U, Q> const & m);
 
 		GLM_FUNC_DECL explicit tmat3x4(tmat2x2<T, P> const & x);
 		GLM_FUNC_DECL explicit tmat3x4(tmat3x3<T, P> const & x);

+ 2 - 7
glm/detail/type_mat4x2.hpp

@@ -106,13 +106,8 @@ namespace glm
 		//////////////////////////////////////
 		// Matrix conversions
 
-#		ifdef GLM_FORCE_EXPLICIT_CTOR
-			template <typename U, precision Q>
-			GLM_FUNC_DECL explicit tmat4x2(tmat4x2<U, Q> const & m);
-#		else
-			template <typename U, precision Q>
-			GLM_FUNC_DECL tmat4x2(tmat4x2<U, Q> const & m);
-#		endif
+		template <typename U, precision Q>
+		GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tmat4x2(tmat4x2<U, Q> const & m);
 
 		GLM_FUNC_DECL explicit tmat4x2(tmat2x2<T, P> const & x);
 		GLM_FUNC_DECL explicit tmat4x2(tmat3x3<T, P> const & x);

+ 2 - 7
glm/detail/type_mat4x3.hpp

@@ -105,13 +105,8 @@ namespace glm
 		//////////////////////////////////////
 		// Matrix conversions
 
-#		ifdef GLM_FORCE_EXPLICIT_CTOR
-			template <typename U, precision Q>
-			GLM_FUNC_DECL explicit tmat4x3(tmat4x3<U, Q> const & m);
-#		else
-			template <typename U, precision Q>
-			GLM_FUNC_DECL tmat4x3(tmat4x3<U, Q> const & m);
-#		endif
+		template <typename U, precision Q>
+		GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tmat4x3(tmat4x3<U, Q> const & m);
 
 		GLM_FUNC_DECL explicit tmat4x3(tmat2x2<T, P> const & x);
 		GLM_FUNC_DECL explicit tmat4x3(tmat3x3<T, P> const & x);

+ 2 - 7
glm/detail/type_mat4x4.hpp

@@ -110,13 +110,8 @@ namespace glm
 		//////////////////////////////////////
 		// Matrix conversions
 
-#		ifdef GLM_FORCE_EXPLICIT_CTOR
-			template <typename U, precision Q>
-			GLM_FUNC_DECL explicit tmat4x4(tmat4x4<U, Q> const & m);
-#		else
-			template <typename U, precision Q>
-			GLM_FUNC_DECL tmat4x4(tmat4x4<U, Q> const & m);
-#		endif
+		template <typename U, precision Q>
+		GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tmat4x4(tmat4x4<U, Q> const & m);
 
 		GLM_FUNC_DECL explicit tmat4x4(tmat2x2<T, P> const & x);
 		GLM_FUNC_DECL explicit tmat4x4(tmat3x3<T, P> const & x);

+ 3 - 9
glm/detail/type_vec1.hpp

@@ -136,15 +136,9 @@ namespace glm
 		template <typename U, precision Q>
 		GLM_FUNC_DECL explicit tvec1(tvec4<U, Q> const & v);
 
-#		ifdef GLM_FORCE_EXPLICIT_CTOR
-			//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
-			template <typename U, precision Q>
-			GLM_FUNC_DECL explicit tvec1(tvec1<U, Q> const & v);
-#		else
-			//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
-			template <typename U, precision Q>
-			GLM_FUNC_DECL tvec1(tvec1<U, Q> const & v);
-#		endif
+		//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+		template <typename U, precision Q>
+		GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tvec1(tvec1<U, Q> const & v);
 
 		//////////////////////////////////////
 		// Swizzle constructors

+ 3 - 9
glm/detail/type_vec2.hpp

@@ -144,15 +144,9 @@ namespace glm
 		template <typename U, precision Q>
 		GLM_FUNC_DECL explicit tvec2(tvec4<U, Q> const & v);
 
-#		ifdef GLM_FORCE_EXPLICIT_CTOR
-			//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
-			template <typename U, precision Q>
-			GLM_FUNC_DECL explicit tvec2(tvec2<U, Q> const & v);
-#		else
-			//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
-			template <typename U, precision Q>
-			GLM_FUNC_DECL tvec2(tvec2<U, Q> const & v);
-#		endif
+		//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+		template <typename U, precision Q>
+		GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tvec2(tvec2<U, Q> const & v);
 
 		//////////////////////////////////////
 		// Swizzle constructors

+ 3 - 9
glm/detail/type_vec3.hpp

@@ -154,15 +154,9 @@ namespace glm
 		template <typename U, precision Q>
 		GLM_FUNC_DECL explicit tvec3(tvec4<U, Q> const & v);
 
-#		ifdef GLM_FORCE_EXPLICIT_CTOR
-			//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
-			template <typename U, precision Q>
-			GLM_FUNC_DECL explicit tvec3(tvec3<U, Q> const & v);
-#		else
-			//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
-			template <typename U, precision Q>
-			GLM_FUNC_DECL tvec3(tvec3<U, Q> const & v);
-#		endif
+		//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+		template <typename U, precision Q>
+		GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tvec3(tvec3<U, Q> const & v);
 
 		//////////////////////////////////////
 		// Swizzle constructors

+ 4 - 10
glm/detail/type_vec4.hpp

@@ -229,16 +229,10 @@ namespace detail
 		//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
 		template <typename A, typename B, precision Q>
 		GLM_FUNC_DECL explicit tvec4(tvec2<A, Q> const & a, tvec2<B, Q> const & b);
-		
-#		ifdef GLM_FORCE_EXPLICIT_CTOR
-			//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
-			template <typename U, precision Q>
-			GLM_FUNC_DECL explicit tvec4(tvec4<U, Q> const & v);
-#		else
-			//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
-			template <typename U, precision Q>
-			GLM_FUNC_DECL tvec4(tvec4<U, Q> const & v);
-#		endif
+
+		//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
+		template <typename U, precision Q>
+		GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tvec4(tvec4<U, Q> const & v);
 
 		//////////////////////////////////////
 		// Swizzle constructors

+ 6 - 11
glm/gtc/quaternion.hpp

@@ -108,24 +108,19 @@ namespace glm
 		GLM_FUNC_DECL tquat(T const & w, T const & x, T const & y, T const & z);
 
 		//////////////////////////////////////
-		// Convertions
+		// Conversions
+
+		template <typename U, precision Q>
+		GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tquat(tquat<U, Q> const & q);
 
-#		ifdef GLM_FORCE_EXPLICIT_CTOR
-			template <typename U, precision Q>
-			GLM_FUNC_DECL explicit tquat(tquat<U, Q> const & q);
-#		else
-			template <typename U, precision Q>
-			GLM_FUNC_DECL tquat(tquat<U, Q> const & q);
-#		endif
-		
 		// explicit conversion operators
 #		if GLM_HAS_EXPLICIT_CONVERSION_OPERATORS
 			GLM_FUNC_DECL explicit operator tmat3x3<T, P>();
 			GLM_FUNC_DECL explicit operator tmat4x4<T, P>();
 #		endif
-		
+
 		/// Create a quaternion from two normalized axis
-		/// 
+		///
 		/// @param u A first normalized axis
 		/// @param v A second normalized axis
 		/// @see gtc_quaternion

+ 2 - 7
glm/gtx/dual_quaternion.hpp

@@ -110,13 +110,8 @@ namespace glm
 		//////////////////////////////////////////////////////////////
 		// tdualquat conversions
 
-#		ifdef GLM_FORCE_EXPLICIT_CTOR
-			template <typename U, precision Q>
-			GLM_FUNC_DECL explicit tdualquat(tdualquat<U, Q> const & q);
-#		else
-			template <typename U, precision Q>
-			GLM_FUNC_DECL tdualquat(tdualquat<U, Q> const & q);
-#		endif
+		template <typename U, precision Q>
+		GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tdualquat(tdualquat<U, Q> const & q);
 
 		GLM_FUNC_DECL explicit tdualquat(tmat2x4<T, P> const & holder_mat);
 		GLM_FUNC_DECL explicit tdualquat(tmat3x4<T, P> const & aug_mat);