瀏覽代碼

Fixed GLM_FORCE_SIZE_FUNC support overlook #245. Added uninitiallized constructor to quaternion. Fixed lack of conscistency or quaternion constructors with other types. Various uninitilized constructor optimizations

Christophe Riccio 11 年之前
父節點
當前提交
c2d542562e

二進制
doc/glm.docx


+ 1 - 1
glm/detail/func_common.inl

@@ -82,7 +82,7 @@ namespace detail
 		GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y, vecType<bool, P> const & a)
 		{
 			vecType<T, P> Result;
-			for(length_t i = 0; i < x.length(); ++i)
+			for(length_t i = 0; i < detail::component_count(x); ++i)
 				Result[i] = a[i] ? y[i] : x[i];
 			return Result;
 		}

+ 3 - 3
glm/detail/func_matrix.inl

@@ -60,7 +60,7 @@ namespace detail
 		GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, tvec3, tvec3>::type call(tvec3<T, P> const & c, tvec3<T, P> const & r)
 		{
 			tmat3x3<T, P> m(tmat3x3<T, P>::_null);
-			for(length_t i(0); i < m.length(); ++i)
+			for(detail::component_count_t i = 0; i < detail::component_count(m); ++i)
 				m[i] = c * r[i];
 			return m;
 		}
@@ -72,7 +72,7 @@ namespace detail
 		GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, tvec4, tvec4>::type call(tvec4<T, P> const & c, tvec4<T, P> const & r)
 		{
 			tmat4x4<T, P> m(tmat4x4<T, P>::_null);
-			for(length_t i(0); i < m.length(); ++i)
+			for(detail::component_count_t i = 0; i < detail::component_count(m); ++i)
 				m[i] = c * r[i];
 			return m;
 		}
@@ -424,7 +424,7 @@ namespace detail
 		GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'matrixCompMult' only accept floating-point inputs");
 
 		matType<T, P> result(matType<T, P>::_null);
-		for(length_t i = 0; i < result.length(); ++i)
+		for(detail::component_count_t i = 0; i < detail::component_count(result); ++i)
 			result[i] = x[i] * y[i];
 		return result;
 	}

+ 15 - 15
glm/detail/func_vector_relational.inl

@@ -39,10 +39,10 @@ namespace glm
 	{
 		GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer,
 			"Invalid template instantiation of 'lessThan', GLM vector types required floating-point or integer value types vectors");
-		assert(x.length() == y.length());
+		assert(detail::component_count(x) == detail::component_count(y));
 
 		typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
-		for(int i = 0; i < x.length(); ++i)
+		for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
 			Result[i] = x[i] < y[i];
 
 		return Result;
@@ -57,10 +57,10 @@ namespace glm
 	{
 		GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer,
 			"Invalid template instantiation of 'lessThanEqual', GLM vector types required floating-point or integer value types vectors");
-		assert(x.length() == y.length());
+		assert(detail::component_count(x) == detail::component_count(y));
 
 		typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
-		for(int i = 0; i < x.length(); ++i)
+		for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
 			Result[i] = x[i] <= y[i];
 		return Result;
 	}
@@ -74,10 +74,10 @@ namespace glm
 	{
 		GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer,
 			"Invalid template instantiation of 'greaterThan', GLM vector types required floating-point or integer value types vectors");
-		assert(x.length() == y.length());
+		assert(detail::component_count(x) == detail::component_count(y));
 
 		typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
-		for(int i = 0; i < x.length(); ++i)
+		for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
 			Result[i] = x[i] > y[i];
 		return Result;
 	}
@@ -91,10 +91,10 @@ namespace glm
 	{
 		GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer,
 			"Invalid template instantiation of 'greaterThanEqual', GLM vector types required floating-point or integer value types vectors");
-		assert(x.length() == y.length());
+		assert(detail::component_count(x) == detail::component_count(y));
 
 		typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
-		for(int i = 0; i < x.length(); ++i)
+		for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
 			Result[i] = x[i] >= y[i];
 		return Result;
 	}
@@ -106,10 +106,10 @@ namespace glm
 		vecType<T, P> const & y
 	)
 	{
-		assert(x.length() == y.length());
+		assert(detail::component_count(x) == detail::component_count(y));
 
 		typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
-		for(int i = 0; i < x.length(); ++i)
+		for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
 			Result[i] = x[i] == y[i];
 		return Result;
 	}
@@ -121,10 +121,10 @@ namespace glm
 		vecType<T, P> const & y
 	)
 	{
-		assert(x.length() == y.length());
+		assert(detail::component_count(x) == detail::component_count(y));
 
 		typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
-		for(int i = 0; i < x.length(); ++i)
+		for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
 			Result[i] = x[i] != y[i];
 		return Result;
 	}
@@ -133,7 +133,7 @@ namespace glm
 	GLM_FUNC_QUALIFIER bool any(vecType<bool, P> const & v)
 	{
 		bool Result = false;
-		for(int i = 0; i < v.length(); ++i)
+		for(detail::component_count_t i = 0; i < detail::component_count(v); ++i)
 			Result = Result || v[i];
 		return Result;
 	}
@@ -142,7 +142,7 @@ namespace glm
 	GLM_FUNC_QUALIFIER bool all(vecType<bool, P> const & v)
 	{
 		bool Result = true;
-		for(int i = 0; i < v.length(); ++i)
+		for(detail::component_count_t i = 0; i < detail::component_count(v); ++i)
 			Result = Result && v[i];
 		return Result;
 	}
@@ -151,7 +151,7 @@ namespace glm
 	GLM_FUNC_QUALIFIER vecType<bool, P> not_(vecType<bool, P> const & v)
 	{
 		typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
-		for(int i = 0; i < v.length(); ++i)
+		for(detail::component_count_t i = 0; i < detail::component_count(v); ++i)
 			Result[i] = !v[i];
 		return Result;
 	}

+ 44 - 25
glm/detail/setup.hpp

@@ -757,31 +757,6 @@
 #	endif
 #endif//GLM_MESSAGE
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Length type
-
-// User defines: GLM_FORCE_SIZE_T_LENGTH GLM_FORCE_SIZE_FUNC
-
-namespace glm
-{
-	typedef std::size_t size_t;
-#if defined(GLM_FORCE_SIZE_T_LENGTH) || defined(GLM_FORCE_SIZE_FUNC)
-	typedef std::size_t length_t;
-#else
-	typedef int length_t;
-#endif
-}//namespace glm
-
-#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_FORCE_SIZE_T_LENGTH))
-#	define GLM_MESSAGE_FORCE_SIZE_T_LENGTH
-#	if defined(GLM_FORCE_SIZE_T_LENGTH)
-#		pragma message("GLM: .length() returns glm::length_t, a typedef of std::size_t")
-#	else
-#		pragma message("GLM: .length() returns glm::length_t, a typedef of int following the GLSL specification")
-#		pragma message("GLM: #define GLM_FORCE_SIZE_T_LENGTH for .length() to return a std::size_t")
-#	endif
-#endif//GLM_MESSAGE
-
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // Qualifiers
 
@@ -816,3 +791,47 @@ namespace glm
 #else
 #	define GLM_CONSTEXPR
 #endif
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Length type
+
+// User defines: GLM_FORCE_SIZE_T_LENGTH GLM_FORCE_SIZE_FUNC
+
+namespace glm
+{
+	typedef std::size_t size_t;
+#if defined(GLM_FORCE_SIZE_T_LENGTH) || defined(GLM_FORCE_SIZE_FUNC)
+	typedef size_t length_t;
+#else
+	typedef int length_t;
+#endif
+
+namespace detail
+{
+	template <typename genType>
+	GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t component_count(genType const & m)
+	{
+#		if GLM_FORCE_SIZE_FUNC
+			return m.size();
+#		else
+			return m.length();
+#		endif
+	}
+
+#	if GLM_FORCE_SIZE_FUNC
+		typedef size_t component_count_t;
+#	else
+		typedef length_t component_count_t;
+#	endif
+}//namespace detail
+}//namespace glm
+
+#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_FORCE_SIZE_T_LENGTH))
+#	define GLM_MESSAGE_FORCE_SIZE_T_LENGTH
+#	if defined(GLM_FORCE_SIZE_T_LENGTH)
+#		pragma message("GLM: .length() returns glm::length_t, a typedef of std::size_t")
+#	else
+#		pragma message("GLM: .length() returns glm::length_t, a typedef of int following the GLSL specification")
+#		pragma message("GLM: #define GLM_FORCE_SIZE_T_LENGTH for .length() to return a size_t")
+#	endif
+#endif//GLM_MESSAGE

+ 1 - 0
glm/detail/type_mat.inl

@@ -25,3 +25,4 @@
 /// @date 2011-06-15 / 2011-06-15
 /// @author Christophe Riccio
 ///////////////////////////////////////////////////////////////////////////////////
+

+ 1 - 1
glm/ext.hpp

@@ -76,6 +76,7 @@
 #include "./gtc/type_precision.hpp"
 #include "./gtc/type_ptr.hpp"
 #include "./gtc/ulp.hpp"
+#include "./gtc/vec1.hpp"
 
 #include "./gtx/associated_min_max.hpp"
 #include "./gtx/bit.hpp"
@@ -123,7 +124,6 @@
 #endif
 #include "./gtx/transform.hpp"
 #include "./gtx/transform2.hpp"
-#include "./gtx/vec1.hpp"
 #include "./gtx/vector_angle.hpp"
 #include "./gtx/vector_query.hpp"
 #include "./gtx/wrap.hpp"

+ 6 - 6
glm/gtc/matrix_access.inl

@@ -36,10 +36,10 @@ namespace glm
 		typename genType::row_type const & x
 	)
 	{
-		assert(index >= 0 && index < m[0].length());
+		assert(index >= 0 && static_cast<detail::component_count_t>(index) < detail::component_count(m[0]));
 
 		genType Result = m;
-		for(length_t i = 0; i < m.length(); ++i)
+		for(detail::component_count_t i = 0; i < detail::component_count(m); ++i)
 			Result[i][index] = x[i];
 		return Result;
 	}
@@ -51,10 +51,10 @@ namespace glm
 		length_t const & index
 	)
 	{
-		assert(index >= 0 && index < m[0].length());
+		assert(index >= 0 && static_cast<detail::component_count_t>(index) < detail::component_count(m[0]));
 
 		typename genType::row_type Result;
-		for(length_t i = 0; i < m.length(); ++i)
+		for(detail::component_count_t i = 0; i < detail::component_count(m); ++i)
 			Result[i] = m[i][index];
 		return Result;
 	}
@@ -67,7 +67,7 @@ namespace glm
 		typename genType::col_type const & x
 	)
 	{
-		assert(index >= 0 && index < m.length());
+		assert(index >= 0 && static_cast<detail::component_count_t>(index) < detail::component_count(m));
 
 		genType Result = m;
 		Result[index] = x;
@@ -81,7 +81,7 @@ namespace glm
 		length_t const & index
 	)
 	{
-		assert(index >= 0 && index < m.length());
+		assert(index >= 0 && static_cast<detail::component_count_t>(index) < detail::component_count(m));
 
 		return m[index];
 	}

+ 14 - 13
glm/gtc/quaternion.hpp

@@ -58,7 +58,7 @@ namespace glm
 	template <typename T, precision P>
 	struct tquat
 	{
-		enum ctor{null};
+		enum ctor{_null};
 
 		typedef T value_type;
 		typedef tvec4<bool, P> bool_type;
@@ -74,19 +74,20 @@ namespace glm
 		GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
 #endif//GLM_FORCE_SIZE_FUNC
 
-		// Constructors
+		//////////////////////////////////////
+		// Implicit basic constructors
+
 		GLM_FUNC_DECL tquat();
-		template <typename U, precision Q>
-		GLM_FUNC_DECL explicit tquat(
-			tquat<U, Q> const & q);
-		GLM_FUNC_DECL tquat(
-			T const & s,
-			tvec3<T, P> const & v);
-		GLM_FUNC_DECL tquat(
-			T const & w,
-			T const & x,
-			T const & y,
-			T const & z);
+		GLM_FUNC_DECL tquat(tquat<T, P> const & q);
+		template <precision Q>
+		GLM_FUNC_DECL tquat(tquat<T, Q> const & q);
+
+		//////////////////////////////////////
+		// Explicit basic constructors
+
+		GLM_FUNC_DECL explicit tquat(ctor);
+		GLM_FUNC_DECL explicit tquat(T const & s, tvec3<T, P> const & v);
+		GLM_FUNC_DECL tquat(T const & w, T const & x, T const & y, T const & z);
 
 		// Convertions
 

+ 36 - 21
glm/gtc/quaternion.inl

@@ -68,10 +68,9 @@ namespace detail
 	{}
 
 	template <typename T, precision P>
-	template <typename U, precision Q>
 	GLM_FUNC_QUALIFIER tquat<T, P>::tquat
 	(
-		tquat<U, Q> const & q
+		tquat<T, P> const & q
 	) :
 		x(q.x),
 		y(q.y),
@@ -79,6 +78,22 @@ namespace detail
 		w(q.w)
 	{}
 
+	template <typename T, precision P>
+	template <precision Q>
+	GLM_FUNC_QUALIFIER tquat<T, P>::tquat
+	(
+		tquat<T, Q> const & q
+	) :
+		x(q.x),
+		y(q.y),
+		z(q.z),
+		w(q.w)
+	{}
+
+	template <typename T, precision P>
+	GLM_FUNC_QUALIFIER tquat<T, P>::tquat(ctor)
+	{}
+
 	template <typename T, precision P>
 	GLM_FUNC_QUALIFIER tquat<T, P>::tquat
 	(
@@ -731,7 +746,7 @@ namespace detail
 		T biggestVal = sqrt(fourBiggestSquaredMinus1 + T(1)) * T(0.5);
 		T mult = static_cast<T>(0.25) / biggestVal;
 
-		tquat<T, P> Result;
+		tquat<T, P> Result(tquat<T, P>::_null);
 		switch(biggestIndex)
 		{
 		case 0:
@@ -804,16 +819,16 @@ namespace detail
 		tvec3<T, P> const & v
 	)
 	{
-		tquat<T, P> result;
+		tquat<T, P> Result(tquat<T, P>::_null);
 
 		T const a(angle);
 		T const s = glm::sin(a * static_cast<T>(0.5));
 
-		result.w = glm::cos(a * static_cast<T>(0.5));
-		result.x = v.x * s;
-		result.y = v.y * s;
-		result.z = v.z * s;
-		return result;
+		Result.w = glm::cos(a * static_cast<T>(0.5));
+		Result.x = v.x * s;
+		Result.y = v.y * s;
+		Result.z = v.z * s;
+		return Result;
 	}
 
 	template <typename T, precision P>
@@ -823,8 +838,8 @@ namespace detail
 		tquat<T, P> const & y
 	)
 	{
-		tvec4<bool, P> Result;
-		for(length_t i = 0; i < x.length(); ++i)
+		tvec4<bool, P> Result(tvec4<bool, P>::_null);
+		for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
 			Result[i] = x[i] < y[i];
 		return Result;
 	}
@@ -836,8 +851,8 @@ namespace detail
 		tquat<T, P> const & y
 	)
 	{
-		tvec4<bool, P> Result;
-		for(length_t i = 0; i < x.length(); ++i)
+		tvec4<bool, P> Result(tvec4<bool, P>::_null);
+		for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
 			Result[i] = x[i] <= y[i];
 		return Result;
 	}
@@ -849,8 +864,8 @@ namespace detail
 		tquat<T, P> const & y
 	)
 	{
-		tvec4<bool, P> Result;
-		for(length_t i = 0; i < x.length(); ++i)
+		tvec4<bool, P> Result(tvec4<bool, P>::_null);
+		for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
 			Result[i] = x[i] > y[i];
 		return Result;
 	}
@@ -862,8 +877,8 @@ namespace detail
 		tquat<T, P> const & y
 	)
 	{
-		tvec4<bool, P> Result;
-		for(length_t i = 0; i < x.length(); ++i)
+		tvec4<bool, P> Result(tvec4<bool, P>::_null);
+		for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
 			Result[i] = x[i] >= y[i];
 		return Result;
 	}
@@ -875,8 +890,8 @@ namespace detail
 		tquat<T, P> const & y
 	)
 	{
-		tvec4<bool, P> Result;
-		for(length_t i = 0; i < x.length(); ++i)
+		tvec4<bool, P> Result(tvec4<bool, P>::_null);
+		for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
 			Result[i] = x[i] == y[i];
 		return Result;
 	}
@@ -888,8 +903,8 @@ namespace detail
 		tquat<T, P> const & y
 	)
 	{
-		tvec4<bool, P> Result;
-		for(length_t i = 0; i < x.length(); ++i)
+		tvec4<bool, P> Result(tvec4<bool, P>::_null);
+		for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
 			Result[i] = x[i] != y[i];
 		return Result;
 	}

+ 10 - 10
glm/gtc/ulp.inl

@@ -227,8 +227,8 @@ namespace glm
 	template<typename T, precision P, template<typename, precision> class vecType>
 	GLM_FUNC_QUALIFIER vecType<T, P> next_float(vecType<T, P> const & x)
 	{
-		vecType<T, P> Result;
-		for(length_t i = 0; i < Result.length(); ++i)
+		vecType<T, P> Result(vecType<T, P>::_null);
+		for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 			Result[i] = next_float(x[i]);
 		return Result;
 	}
@@ -262,8 +262,8 @@ namespace glm
 	template<typename T, precision P, template<typename, precision> class vecType>
 	GLM_FUNC_QUALIFIER vecType<T, P> prev_float(vecType<T, P> const & x)
 	{
-		vecType<T, P> Result;
-		for(length_t i = 0; i < Result.length(); ++i)
+		vecType<T, P> Result(vecType<T, P>::_null);
+		for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 			Result[i] = prev_float(x[i]);
 		return Result;
 	}
@@ -280,8 +280,8 @@ namespace glm
 	template<typename T, precision P, template<typename, precision> class vecType>
 	GLM_FUNC_QUALIFIER vecType<T, P> next_float(vecType<T, P> const & x, vecType<uint, P> const & ulps)
 	{
-		vecType<T, P> Result;
-		for(length_t i = 0; i < Result.length(); ++i)
+		vecType<T, P> Result(vecType<T, P>::_null);
+		for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 			Result[i] = next_float(x[i], ulps[i]);
 		return Result;
 	}
@@ -298,8 +298,8 @@ namespace glm
 	template<typename T, precision P, template<typename, precision> class vecType>
 	GLM_FUNC_QUALIFIER vecType<T, P> prev_float(vecType<T, P> const & x, vecType<uint, P> const & ulps)
 	{
-		vecType<T, P> Result;
-		for(length_t i = 0; i < Result.length(); ++i)
+		vecType<T, P> Result(vecType<T, P>::_null);
+		for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 			Result[i] = prev_float(x[i], ulps[i]);
 		return Result;
 	}
@@ -338,8 +338,8 @@ namespace glm
 	template<typename T, precision P, template<typename, precision> class vecType>
 	GLM_FUNC_QUALIFIER vecType<uint, P> float_distance(vecType<T, P> const & x, vecType<T, P> const & y)
 	{
-		vecType<uint, P> Result;
-		for(length_t i = 0; i < Result.length(); ++i)
+		vecType<uint, P> Result(vecType<T, P>::_null);
+		for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 			Result[i] = float_distance(x[i], y[i]);
 		return Result;
 	}

+ 0 - 0
glm/gtx/vec1.hpp → glm/gtc/vec1.hpp


+ 0 - 0
glm/gtx/vec1.inl → glm/gtc/vec1.inl


+ 98 - 100
glm/gtx/associated_min_max.inl

@@ -23,10 +23,8 @@ GLM_FUNC_QUALIFIER tvec2<U, P> associatedMin
 	const tvec2<T, P>& y, const tvec2<U, P>& b
 )
 {
-	tvec2<U, P> Result;
-	//Result.x = x[0] < y[0] ? a[0] : b[0];
-	//Result.y = x[1] < y[1] ? a[1] : b[1];
-	for(typename tvec2<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec2<U, P> Result(tvec2<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x[i] < y[i] ? a[i] : b[i];
 	return Result;
 }
@@ -38,8 +36,8 @@ GLM_FUNC_QUALIFIER tvec3<U, P> associatedMin
 	const tvec3<T, P>& y, const tvec3<U, P>& b
 )
 {
-	tvec3<U, P> Result;
-	for(typename tvec3<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec3<U, P> Result(tvec3<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x[i] < y[i] ? a[i] : b[i];
 	return Result;
 }
@@ -51,8 +49,8 @@ GLM_FUNC_QUALIFIER tvec4<U, P> associatedMin
 	const tvec4<T, P>& y, const tvec4<U, P>& b
 )
 {
-	tvec4<U, P> Result;
-	for(typename tvec4<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec4<U, P> Result(tvec4<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x[i] < y[i] ? a[i] : b[i];
 	return Result;
 }
@@ -64,8 +62,8 @@ GLM_FUNC_QUALIFIER tvec2<U, P> associatedMin
 	T y, const tvec2<U, P>& b
 )
 {
-	tvec2<U, P> Result;
-	for(typename tvec2<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec2<U, P> Result(tvec2<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x < y ? a[i] : b[i];
 	return Result;
 }
@@ -77,8 +75,8 @@ GLM_FUNC_QUALIFIER tvec3<U, P> associatedMin
 	T y, const tvec3<U, P>& b
 )
 {
-	tvec3<U, P> Result;
-	for(typename tvec3<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec3<U, P> Result(tvec3<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x < y ? a[i] : b[i];
 	return Result;
 }
@@ -90,8 +88,8 @@ GLM_FUNC_QUALIFIER tvec4<U, P> associatedMin
 	T y, const tvec4<U, P>& b
 )
 {
-	tvec4<U, P> Result;
-	for(typename tvec4<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec4<U, P> Result(tvec4<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x < y ? a[i] : b[i];
 	return Result;
 }
@@ -103,8 +101,8 @@ GLM_FUNC_QUALIFIER tvec2<U, P> associatedMin
 	tvec2<T, P> const & y, U b
 )
 {
-	tvec2<U, P> Result;
-	for(typename tvec2<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec2<U, P> Result(tvec2<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x[i] < y[i] ? a : b;
 	return Result;
 }
@@ -112,12 +110,12 @@ GLM_FUNC_QUALIFIER tvec2<U, P> associatedMin
 template<typename T, typename U, precision P>
 GLM_FUNC_QUALIFIER tvec3<U, P> associatedMin
 (
-	const tvec3<T, P>& x, U a,
-	const tvec3<T, P>& y, U b
+	tvec3<T, P> const & x, U a,
+	tvec3<T, P> const & y, U b
 )
 {
-	tvec3<U, P> Result;
-	for(typename tvec3<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec3<U, P> Result(tvec3<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x[i] < y[i] ? a : b;
 	return Result;
 }
@@ -129,8 +127,8 @@ GLM_FUNC_QUALIFIER tvec4<U, P> associatedMin
 	const tvec4<T, P>& y, U b
 )
 {
-	tvec4<U, P> Result;
-	for(typename tvec4<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec4<U, P> Result(tvec4<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x[i] < y[i] ? a : b;
 	return Result;
 }
@@ -156,8 +154,8 @@ GLM_FUNC_QUALIFIER tvec2<U, P> associatedMin
 	const tvec2<T, P>& z, const tvec2<U, P>& c
 )
 {
-	tvec2<U, P> Result;
-	for(typename tvec2<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec2<U, P> Result(tvec2<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x[i] < y[i] ? (x[i] < z[i] ? a[i] : c[i]) : (y[i] < z[i] ? b[i] : c[i]);
 	return Result;
 }
@@ -170,8 +168,8 @@ GLM_FUNC_QUALIFIER tvec3<U, P> associatedMin
 	const tvec3<T, P>& z, const tvec3<U, P>& c
 )
 {
-	tvec3<U, P> Result;
-	for(typename tvec3<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec3<U, P> Result(tvec3<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x[i] < y[i] ? (x[i] < z[i] ? a[i] : c[i]) : (y[i] < z[i] ? b[i] : c[i]);
 	return Result;
 }
@@ -184,8 +182,8 @@ GLM_FUNC_QUALIFIER tvec4<U, P> associatedMin
 	const tvec4<T, P>& z, const tvec4<U, P>& c
 )
 {
-	tvec4<U, P> Result;
-	for(typename tvec4<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec4<U, P> Result(tvec4<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x[i] < y[i] ? (x[i] < z[i] ? a[i] : c[i]) : (y[i] < z[i] ? b[i] : c[i]);
 	return Result;
 }
@@ -218,8 +216,8 @@ GLM_FUNC_QUALIFIER tvec2<U, P> associatedMin
 	const tvec2<T, P>& w, const tvec2<U, P>& d
 )
 {
-	tvec2<U, P> Result;
-	for(typename tvec2<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec2<U, P> Result(tvec2<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 	{
 		T Test1 = min(x[i], y[i]);
 		T Test2 = min(z[i], w[i]);
@@ -240,8 +238,8 @@ GLM_FUNC_QUALIFIER tvec3<U, P> associatedMin
 	const tvec3<T, P>& w, const tvec3<U, P>& d
 )
 {
-	tvec3<U, P> Result;
-	for(typename tvec3<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec3<U, P> Result(tvec3<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 	{
 		T Test1 = min(x[i], y[i]);
 		T Test2 = min(z[i], w[i]);
@@ -262,8 +260,8 @@ GLM_FUNC_QUALIFIER tvec4<U, P> associatedMin
 	const tvec4<T, P>& w, const tvec4<U, P>& d
 )
 {
-	tvec4<U, P> Result;
-	for(typename tvec4<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec4<U, P> Result(tvec4<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 	{
 		T Test1 = min(x[i], y[i]);
 		T Test2 = min(z[i], w[i]);
@@ -287,8 +285,8 @@ GLM_FUNC_QUALIFIER tvec2<U, P> associatedMin
 	T Test1 = min(x, y);
 	T Test2 = min(z, w);
 
-	tvec2<U, P> Result;
-	for(typename tvec2<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec2<U, P> Result(tvec2<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 	{
 		U Result1 = x < y ? a[i] : b[i];
 		U Result2 = z < w ? c[i] : d[i];
@@ -310,8 +308,8 @@ GLM_FUNC_QUALIFIER tvec3<U, P> associatedMin
 	T Test1 = min(x, y);
 	T Test2 = min(z, w);
 
-	tvec3<U, P> Result;
-	for(typename tvec3<U, P>::size_type i = 0; i < tvec3<U, P>::value_size; ++i)
+	tvec3<U, P> Result(tvec3<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 	{
 		U Result1 = x < y ? a[i] : b[i];
 		U Result2 = z < w ? c[i] : d[i];
@@ -333,8 +331,8 @@ GLM_FUNC_QUALIFIER tvec4<U, P> associatedMin
 	T Test1 = min(x, y);
 	T Test2 = min(z, w);
 
-	tvec4<U, P> Result;
-	for(typename tvec4<U, P>::size_type i = 0; i < tvec4<U, P>::value_size; ++i)
+	tvec4<U, P> Result(tvec4<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 	{
 		U Result1 = x < y ? a[i] : b[i];
 		U Result2 = z < w ? c[i] : d[i];
@@ -353,8 +351,8 @@ GLM_FUNC_QUALIFIER tvec2<U, P> associatedMin
 	const tvec2<T, P>& w, U d
 )
 {
-	tvec2<U, P> Result;
-	for(typename tvec2<T, P>::size_type i = 0; i < tvec2<T, P>::value_size(); ++i)
+	tvec2<U, P> Result(tvec2<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 	{
 		T Test1 = min(x[i], y[i]);
 		T Test2 = min(z[i], w[i]);;
@@ -375,8 +373,8 @@ GLM_FUNC_QUALIFIER tvec3<U, P> associatedMin
 	const tvec3<T, P>& w, U d
 )
 {
-	tvec3<U, P> Result;
-	for(typename tvec3<T, P>::size_type i = 0; i < tvec3<T, P>::value_size(); ++i)
+	tvec3<U, P> Result(tvec3<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 	{
 		T Test1 = min(x[i], y[i]);
 		T Test2 = min(z[i], w[i]);;
@@ -397,8 +395,8 @@ GLM_FUNC_QUALIFIER tvec4<U, P> associatedMin
 	const tvec4<T, P>& w, U d
 )
 {
-	tvec4<U, P> Result;
-	for(typename tvec4<T, P>::size_type i = 0; i < tvec4<T, P>::value_size(); ++i)
+	tvec4<U, P> Result(tvec4<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 	{
 		T Test1 = min(x[i], y[i]);
 		T Test2 = min(z[i], w[i]);;
@@ -424,8 +422,8 @@ GLM_FUNC_QUALIFIER tvec2<U, P> associatedMax
 	const tvec2<T, P>& y, const tvec2<U, P>& b
 )
 {
-	tvec2<U, P> Result;
-	for(typename tvec2<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec2<U, P> Result(tvec2<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x[i] > y[i] ? a[i] : b[i];
 	return Result;
 }
@@ -438,8 +436,8 @@ GLM_FUNC_QUALIFIER tvec3<U, P> associatedMax
 	const tvec3<T, P>& y, const tvec3<U, P>& b
 )
 {
-	tvec3<U, P> Result;
-	for(typename tvec3<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec3<U, P> Result(tvec3<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x[i] > y[i] ? a[i] : b[i];
 	return Result;
 }
@@ -452,8 +450,8 @@ GLM_FUNC_QUALIFIER tvec4<U, P> associatedMax
 	const tvec4<T, P>& y, const tvec4<U, P>& b
 )
 {
-	tvec4<U, P> Result;
-	for(typename tvec4<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec4<U, P> Result(tvec4<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x[i] > y[i] ? a[i] : b[i];
 	return Result;
 }
@@ -466,8 +464,8 @@ GLM_FUNC_QUALIFIER tvec2<U, P> associatedMax
 	T y, const tvec2<U, P>& b
 )
 {
-	tvec2<U, P> Result;
-	for(typename tvec2<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec2<U, P> Result(tvec2<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x > y ? a[i] : b[i];
 	return Result;
 }
@@ -480,8 +478,8 @@ GLM_FUNC_QUALIFIER tvec3<U, P> associatedMax
 	T y, const tvec3<U, P>& b
 )
 {
-	tvec3<U, P> Result;
-	for(typename tvec3<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec3<U, P> Result(tvec3<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x > y ? a[i] : b[i];
 	return Result;
 }
@@ -494,8 +492,8 @@ GLM_FUNC_QUALIFIER tvec4<U, P> associatedMax
 	T y, const tvec4<U, P>& b
 )
 {
-	tvec4<U, P> Result;
-	for(typename tvec4<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec4<U, P> Result(tvec4<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x > y ? a[i] : b[i];
 	return Result;
 }
@@ -508,8 +506,8 @@ GLM_FUNC_QUALIFIER tvec2<U, P> associatedMax
 	const tvec2<T, P>& y, U b
 )
 {
-	tvec2<U, P> Result;
-	for(typename tvec2<T, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec2<U, P> Result(tvec2<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x[i] > y[i] ? a : b;
 	return Result;
 }
@@ -522,8 +520,8 @@ GLM_FUNC_QUALIFIER tvec3<U, P> associatedMax
 	const tvec3<T, P>& y, U b
 )
 {
-	tvec3<U, P> Result;
-	for(typename tvec3<T, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec3<U, P> Result(tvec3<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x[i] > y[i] ? a : b;
 	return Result;
 }
@@ -536,8 +534,8 @@ GLM_FUNC_QUALIFIER tvec4<U, P> associatedMax
 	const tvec4<T, P>& y, U b
 )
 {
-	tvec4<U, P> Result;
-	for(typename tvec4<T, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec4<U, P> Result(tvec4<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x[i] > y[i] ? a : b;
 	return Result;
 }
@@ -564,8 +562,8 @@ GLM_FUNC_QUALIFIER tvec2<U, P> associatedMax
 	const tvec2<T, P>& z, const tvec2<U, P>& c
 )
 {
-	tvec2<U, P> Result;
-	for(typename tvec2<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec2<U, P> Result(tvec2<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a[i] : c[i]) : (y[i] > z[i] ? b[i] : c[i]);
 	return Result;
 }
@@ -579,8 +577,8 @@ GLM_FUNC_QUALIFIER tvec3<U, P> associatedMax
 	const tvec3<T, P>& z, const tvec3<U, P>& c
 )
 {
-	tvec3<U, P> Result;
-	for(typename tvec3<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec3<U, P> Result(tvec3<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a[i] : c[i]) : (y[i] > z[i] ? b[i] : c[i]);
 	return Result;
 }
@@ -594,8 +592,8 @@ GLM_FUNC_QUALIFIER tvec4<U, P> associatedMax
 	const tvec4<T, P>& z, const tvec4<U, P>& c
 )
 {
-	tvec4<U, P> Result;
-	for(typename tvec4<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec4<U, P> Result(tvec4<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a[i] : c[i]) : (y[i] > z[i] ? b[i] : c[i]);
 	return Result;
 }
@@ -609,8 +607,8 @@ GLM_FUNC_QUALIFIER tvec2<U, P> associatedMax
 	T z, const tvec2<U, P>& c
 )
 {
-	tvec2<U, P> Result;
-	for(typename tvec2<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec2<U, P> Result(tvec2<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x > y ? (x > z ? a[i] : c[i]) : (y > z ? b[i] : c[i]);
 	return Result;
 }
@@ -624,8 +622,8 @@ GLM_FUNC_QUALIFIER tvec3<U, P> associatedMax
 	T z, const tvec3<U, P>& c
 )
 {
-	tvec3<U, P> Result;
-	for(typename tvec3<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec3<U, P> Result(tvec3<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x > y ? (x > z ? a[i] : c[i]) : (y > z ? b[i] : c[i]);
 	return Result;
 }
@@ -639,8 +637,8 @@ GLM_FUNC_QUALIFIER tvec4<U, P> associatedMax
 	T z, const tvec4<U, P>& c
 )
 {
-	tvec4<U, P> Result;
-	for(typename tvec4<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec4<U, P> Result(tvec4<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x > y ? (x > z ? a[i] : c[i]) : (y > z ? b[i] : c[i]);
 	return Result;
 }
@@ -654,8 +652,8 @@ GLM_FUNC_QUALIFIER tvec2<U, P> associatedMax
 	const tvec2<T, P>& z, U c
 )
 {
-	tvec2<U, P> Result;
-	for(typename tvec2<T, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec2<U, P> Result(tvec2<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a : c) : (y[i] > z[i] ? b : c);
 	return Result;
 }
@@ -669,8 +667,8 @@ GLM_FUNC_QUALIFIER tvec3<U, P> associatedMax
 	const tvec3<T, P>& z, U c
 )
 {
-	tvec3<U, P> Result;
-	for(typename tvec3<T, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec3<U, P> Result(tvec3<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a : c) : (y[i] > z[i] ? b : c);
 	return Result;
 }
@@ -684,8 +682,8 @@ GLM_FUNC_QUALIFIER tvec4<U, P> associatedMax
 	const tvec4<T, P>& z, U c
 )
 {
-	tvec4<U, P> Result;
-	for(typename tvec4<T, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec4<U, P> Result(tvec4<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 		Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a : c) : (y[i] > z[i] ? b : c);
 	return Result;
 }
@@ -718,8 +716,8 @@ GLM_FUNC_QUALIFIER tvec2<U, P> associatedMax
 	const tvec2<T, P>& w, const tvec2<U, P>& d
 )
 {
-	tvec2<U, P> Result;
-	for(typename tvec2<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec2<U, P> Result(tvec2<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 	{
 		T Test1 = max(x[i], y[i]);
 		T Test2 = max(z[i], w[i]);
@@ -740,8 +738,8 @@ GLM_FUNC_QUALIFIER tvec3<U, P> associatedMax
 	const tvec3<T, P>& w, const tvec3<U, P>& d
 )
 {
-	tvec3<U, P> Result;
-	for(typename tvec3<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec3<U, P> Result(tvec3<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 	{
 		T Test1 = max(x[i], y[i]);
 		T Test2 = max(z[i], w[i]);
@@ -762,8 +760,8 @@ GLM_FUNC_QUALIFIER tvec4<U, P> associatedMax
 	const tvec4<T, P>& w, const tvec4<U, P>& d
 )
 {
-	tvec4<U, P> Result;
-	for(typename tvec4<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec4<U, P> Result(tvec4<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 	{
 		T Test1 = max(x[i], y[i]);
 		T Test2 = max(z[i], w[i]);
@@ -787,8 +785,8 @@ GLM_FUNC_QUALIFIER tvec2<U, P> associatedMax
 	T Test1 = max(x, y);
 	T Test2 = max(z, w);
 
-	tvec2<U, P> Result;
-	for(typename tvec2<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec2<U, P> Result(tvec2<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 	{
 		U Result1 = x > y ? a[i] : b[i];
 		U Result2 = z > w ? c[i] : d[i];
@@ -810,8 +808,8 @@ GLM_FUNC_QUALIFIER tvec3<U, P> associatedMax
 	T Test1 = max(x, y);
 	T Test2 = max(z, w);
 
-	tvec3<U, P> Result;
-	for(typename tvec3<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec3<U, P> Result(tvec3<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 	{
 		U Result1 = x > y ? a[i] : b[i];
 		U Result2 = z > w ? c[i] : d[i];
@@ -833,8 +831,8 @@ GLM_FUNC_QUALIFIER tvec4<U, P> associatedMax
 	T Test1 = max(x, y);
 	T Test2 = max(z, w);
 
-	tvec4<U, P> Result;
-	for(typename tvec4<U, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec4<U, P> Result(tvec4<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 	{
 		U Result1 = x > y ? a[i] : b[i];
 		U Result2 = z > w ? c[i] : d[i];
@@ -853,8 +851,8 @@ GLM_FUNC_QUALIFIER tvec2<U, P> associatedMax
 	const tvec2<T, P>& w, U d
 )
 {
-	tvec2<U, P> Result;
-	for(typename tvec2<T, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec2<U, P> Result(tvec2<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 	{
 		T Test1 = max(x[i], y[i]);
 		T Test2 = max(z[i], w[i]);;
@@ -875,8 +873,8 @@ GLM_FUNC_QUALIFIER tvec3<U, P> associatedMax
 	const tvec3<T, P>& w, U d
 )
 {
-	tvec3<U, P> Result;
-	for(typename tvec3<T, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec3<U, P> Result(tvec3<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 	{
 		T Test1 = max(x[i], y[i]);
 		T Test2 = max(z[i], w[i]);;
@@ -897,8 +895,8 @@ GLM_FUNC_QUALIFIER tvec4<U, P> associatedMax
 	const tvec4<T, P>& w, U d
 )
 {
-	tvec4<U, P> Result;
-	for(typename tvec4<T, P>::size_type i = 0; i < Result.length(); ++i)
+	tvec4<U, P> Result(tvec4<U, P>::_null);
+	for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
 	{
 		T Test1 = max(x[i], y[i]);
 		T Test2 = max(z[i], w[i]);;

+ 1 - 1
glm/gtx/common.hpp

@@ -42,7 +42,7 @@
 #include "../vec2.hpp"
 #include "../vec3.hpp"
 #include "../vec4.hpp"
-#include "../gtx/vec1.hpp"
+#include "../gtc/vec1.hpp"
 
 #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
 #	pragma message("GLM: GLM_GTX_common extension included")

+ 4 - 4
glm/gtx/component_wise.inl

@@ -13,7 +13,7 @@ namespace glm
 	GLM_FUNC_QUALIFIER T compAdd(vecType<T, P> const & v)
 	{
 		T result(0);
-		for(length_t i = 0; i < v.length(); ++i)
+		for(detail::component_count_t i = 0; i < detail::component_count(v); ++i)
 			result += v[i];
 		return result;
 	}
@@ -22,7 +22,7 @@ namespace glm
 	GLM_FUNC_QUALIFIER T compMul(vecType<T, P> const & v)
 	{
 		T result(1);
-		for(length_t i = 0; i < v.length(); ++i)
+		for(detail::component_count_t i = 0; i < detail::component_count(v); ++i)
 			result *= v[i];
 		return result;
 	}
@@ -31,7 +31,7 @@ namespace glm
 	GLM_FUNC_QUALIFIER T compMin(vecType<T, P> const & v)
 	{
 		T result(v[0]);
-		for(length_t i = 1; i < v.length(); ++i)
+		for(detail::component_count_t i = 1; i < detail::component_count(v); ++i)
 			result = min(result, v[i]);
 		return result;
 	}
@@ -40,7 +40,7 @@ namespace glm
 	GLM_FUNC_QUALIFIER T compMax(vecType<T, P> const & v)
 	{
 		T result(v[0]);
-		for(length_t i = 1; i < v.length(); ++i)
+		for(detail::component_count_t i = 1; i < detail::component_count(v); ++i)
 			result = max(result, v[i]);
 		return result;
 	}

+ 19 - 19
glm/gtx/matrix_query.inl

@@ -16,7 +16,7 @@ namespace glm
 	GLM_FUNC_QUALIFIER bool isNull(tmat2x2<T, P> const & m, T const & epsilon)
 	{
 		bool result = true;
-		for(length_t i = 0; result && i < 2 ; ++i)
+		for(detail::component_count_t i = 0; result && i < 2 ; ++i)
 			result = isNull(m[i], epsilon);
 		return result;
 	}
@@ -25,7 +25,7 @@ namespace glm
 	GLM_FUNC_QUALIFIER bool isNull(tmat3x3<T, P> const & m, T const & epsilon)
 	{
 		bool result = true;
-		for(length_t i = 0; result && i < 3 ; ++i)
+		for(detail::component_count_t i = 0; result && i < 3 ; ++i)
 			result = isNull(m[i], epsilon);
 		return result;
 	}
@@ -34,7 +34,7 @@ namespace glm
 	GLM_FUNC_QUALIFIER bool isNull(tmat4x4<T, P> const & m, T const & epsilon)
 	{
 		bool result = true;
-		for(length_t i = 0; result && i < 4 ; ++i)
+		for(detail::component_count_t i = 0; result && i < 4 ; ++i)
 			result = isNull(m[i], epsilon);
 		return result;
 	}
@@ -43,13 +43,13 @@ namespace glm
 	GLM_FUNC_QUALIFIER bool isIdentity(matType<T, P> const & m, T const & epsilon)
 	{
 		bool result = true;
-		for(length_t i(0); result && i < m[0].length(); ++i)
+		for(detail::component_count_t i(0); result && i < detail::component_count(m[0]); ++i)
 		{
-			for(length_t j(0); result && j < i ; ++j)
+			for(detail::component_count_t j(0); result && j < i ; ++j)
 				result = abs(m[i][j]) <= epsilon;
 			if(result)
 				result = abs(m[i][i] - 1) <= epsilon;
-			for(length_t j(i + 1); result && j < m.length(); ++j)
+			for(detail::component_count_t j(i + 1); result && j < detail::component_count(m); ++j)
 				result = abs(m[i][j]) <= epsilon;
 		}
 		return result;
@@ -59,12 +59,12 @@ namespace glm
 	GLM_FUNC_QUALIFIER bool isNormalized(tmat2x2<T, P> const & m, T const & epsilon)
 	{
 		bool result(true);
-		for(length_t i(0); result && i < m.length(); ++i)
+		for(detail::component_count_t i(0); result && i < detail::component_count(m); ++i)
 			result = isNormalized(m[i], epsilon);
-		for(length_t i(0); result && i < m.length(); ++i)
+		for(detail::component_count_t i(0); result && i < detail::component_count(m); ++i)
 		{
 			typename tmat2x2<T, P>::col_type v;
-			for(length_t j(0); j < m.length(); ++j)
+			for(detail::component_count_t j(0); j < detail::component_count(m); ++j)
 				v[j] = m[j][i];
 			result = isNormalized(v, epsilon);
 		}
@@ -75,12 +75,12 @@ namespace glm
 	GLM_FUNC_QUALIFIER bool isNormalized(tmat3x3<T, P> const & m, T const & epsilon)
 	{
 		bool result(true);
-		for(length_t i(0); result && i < m.length(); ++i)
+		for(detail::component_count_t i(0); result && i < detail::component_count(m); ++i)
 			result = isNormalized(m[i], epsilon);
-		for(length_t i(0); result && i < m.length(); ++i)
+		for(detail::component_count_t i(0); result && i < detail::component_count(m); ++i)
 		{
 			typename tmat3x3<T, P>::col_type v;
-			for(length_t j(0); j < m.length(); ++j)
+			for(detail::component_count_t j(0); j < detail::component_count(m); ++j)
 				v[j] = m[j][i];
 			result = isNormalized(v, epsilon);
 		}
@@ -91,12 +91,12 @@ namespace glm
 	GLM_FUNC_QUALIFIER bool isNormalized(tmat4x4<T, P> const & m, T const & epsilon)
 	{
 		bool result(true);
-		for(length_t i(0); result && i < m.length(); ++i)
+		for(detail::component_count_t i(0); result && i < detail::component_count(m); ++i)
 			result = isNormalized(m[i], epsilon);
-		for(length_t i(0); result && i < m.length(); ++i)
+		for(detail::component_count_t i(0); result && i < detail::component_count(m); ++i)
 		{
 			typename tmat4x4<T, P>::col_type v;
-			for(length_t j(0); j < m.length(); ++j)
+			for(detail::component_count_t j(0); j < detail::component_count(m); ++j)
 				v[j] = m[j][i];
 			result = isNormalized(v, epsilon);
 		}
@@ -107,15 +107,15 @@ namespace glm
 	GLM_FUNC_QUALIFIER bool isOrthogonal(matType<T, P> const & m, T const & epsilon)
 	{
 		bool result(true);
-		for(length_t i(0); result && i < m.length() - 1; ++i)
-		for(length_t j(i + 1); result && j < m.length(); ++j)
+		for(detail::component_count_t i(0); result && i < detail::component_count(m) - 1; ++i)
+		for(detail::component_count_t j(i + 1); result && j < detail::component_count(m); ++j)
 			result = areOrthogonal(m[i], m[j], epsilon);
 
 		if(result)
 		{
 			matType<T, P> tmp = transpose(m);
-			for(length_t i(0); result && i < m.length() - 1 ; ++i)
-			for(length_t j(i + 1); result && j < m.length(); ++j)
+			for(detail::component_count_t i(0); result && i < detail::component_count(m) - 1 ; ++i)
+			for(detail::component_count_t j(i + 1); result && j < detail::component_count(m); ++j)
 				result = areOrthogonal(tmp[i], tmp[j], epsilon);
 		}
 		return result;

+ 10 - 10
glm/gtx/range.hpp

@@ -45,32 +45,32 @@ namespace glm
 	/* The glm types provide a .length() member, but for matrices
 	 this only defines the number of columns, so we need to work around this */
 	template <typename T, precision P>
-	length_t number_of_elements_(tvec2<T, P> const & v){
-		return v.length();
+	detail::component_count_t number_of_elements_(tvec2<T, P> const & v){
+		return detail::component_count(v);
 	}
 
 	template <typename T, precision P>
-	length_t number_of_elements_(tvec3<T, P> const & v){
-		return v.length();
+	detail::component_count_t number_of_elements_(tvec3<T, P> const & v){
+		return detail::component_count(v);
 	}
 
 	template <typename T, precision P>
-	length_t number_of_elements_(tvec4<T, P> const & v){
-		return v.length();
+	detail::component_count_t number_of_elements_(tvec4<T, P> const & v){
+		return detail::component_count(v);
 	}
 
 	template <typename genType>
-	length_t number_of_elements_(genType const & v){
-		return v.length() * v[0].length();
+	detail::component_count_t number_of_elements_(genType const & m){
+		return detail::component_count(m) * detail::component_count(m[0]);
 	}
 
 	template <typename genType>
-	const typename genType::value_type * begin(const genType& v){
+	const typename genType::value_type * begin(genType const & v){
 		return value_ptr(v);
 	}
 
 	template <typename genType>
-	const typename genType::value_type * end(const genType& v){
+	const typename genType::value_type * end(genType const & v){
 		return begin(v) + number_of_elements_(v);
 	}
 

+ 1 - 1
test/core/core_func_common.cpp

@@ -12,7 +12,7 @@
 //#include <boost/thread/thread.hpp>
 #include <glm/gtc/constants.hpp>
 #include <glm/gtc/epsilon.hpp>
-#include <glm/gtx/vec1.hpp>
+#include <glm/gtc/vec1.hpp>
 #include <cstdio>
 #include <cmath>
 

+ 1 - 1
test/core/core_func_exponential.cpp

@@ -10,7 +10,7 @@
 #include <glm/common.hpp>
 #include <glm/exponential.hpp>
 #include <glm/gtc/ulp.hpp>
-#include <glm/gtx/vec1.hpp>
+#include <glm/gtc/vec1.hpp>
 
 int test_pow()
 {

+ 1 - 1
test/core/core_type_mat2x2.cpp

@@ -60,7 +60,7 @@ int test_ctr()
 {
 	int Error(0);
 
-#if(GLM_HAS_INITIALIZER_LISTS)
+#if GLM_HAS_INITIALIZER_LISTS
 	glm::mat2x2 m0(
 		glm::vec2(0, 1), 
 		glm::vec2(2, 3));

+ 1 - 1
test/core/core_type_mat2x3.cpp

@@ -34,7 +34,7 @@ int test_ctr()
 {
 	int Error(0);
 	
-#if(GLM_HAS_INITIALIZER_LISTS)
+#if GLM_HAS_INITIALIZER_LISTS
 	glm::mat2x3 m0(
 		glm::vec3(0, 1, 2),
 		glm::vec3(3, 4, 5));

+ 3 - 3
test/core/core_type_vec1.cpp

@@ -1,14 +1,14 @@
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
 ///////////////////////////////////////////////////////////////////////////////////////////////////
-// Created : 2008-08-31
-// Updated : 2008-08-31
+// Created : 2014-10-11
+// Updated : 2014-10-11
 // Licence : This source is under MIT License
 // File    : test/core/type_vec1.cpp
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 #define GLM_SWIZZLE
-#include <glm/gtx/vec1.hpp>
+#include <glm/gtc/vec1.hpp>
 
 int test_operators()
 {

+ 1 - 0
test/gtc/CMakeLists.txt

@@ -12,3 +12,4 @@ glmCreateTestGTC(gtc_reciprocal)
 glmCreateTestGTC(gtc_type_precision)
 glmCreateTestGTC(gtc_type_ptr)
 glmCreateTestGTC(gtc_ulp)
+glmCreateTestGTC(gtc_vec1)

+ 1 - 1
test/gtc/gtc_quaternion.cpp

@@ -273,7 +273,7 @@ int test_quat_ctr()
 {
 	int Error(0);
 
-#	if(GLM_HAS_INITIALIZER_LISTS)
+#	if GLM_HAS_INITIALIZER_LISTS
 	{
 		glm::quat A{0, 1, 2, 3};
 

+ 17 - 0
test/gtc/gtc_vec1.cpp

@@ -0,0 +1,17 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2014-10-11
+// Updated : 2014-10-11
+// Licence : This source is under MIT License
+// File    : test/gtc/vec1.cpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <glm/gtc/vec1.hpp>
+
+int main()
+{
+	int Error = 0;
+
+	return Error;
+}

+ 0 - 1
test/gtx/gtx_common.cpp

@@ -8,7 +8,6 @@
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 #include <glm/gtx/common.hpp>
-#include <glm/gtx/vec1.hpp>
 
 int test_isdenormal()
 {