Browse Source

Fixed const ref issue for vector types. Backport from GLM 0.9.5 branch #116

Christophe Riccio 12 years ago
parent
commit
579ab2b7d2
7 changed files with 63 additions and 152 deletions
  1. 10 10
      glm/core/type_vec2.hpp
  2. 10 40
      glm/core/type_vec2.inl
  3. 10 10
      glm/core/type_vec3.hpp
  4. 10 40
      glm/core/type_vec3.inl
  5. 10 10
      glm/core/type_vec4.hpp
  6. 10 40
      glm/core/type_vec4.inl
  7. 3 2
      readme.txt

+ 10 - 10
glm/core/type_vec2.hpp

@@ -165,19 +165,19 @@ namespace detail
 		GLM_FUNC_DECL tvec2<T> & operator= (tvec2<U> const & v);
 
 		template <typename U> 
-		GLM_FUNC_DECL tvec2<T> & operator+=(U const & s);
+		GLM_FUNC_DECL tvec2<T> & operator+=(U s);
 		template <typename U> 
 		GLM_FUNC_DECL tvec2<T> & operator+=(tvec2<U> const & v);
 		template <typename U> 
-		GLM_FUNC_DECL tvec2<T> & operator-=(U const & s);
+		GLM_FUNC_DECL tvec2<T> & operator-=(U s);
 		template <typename U> 
 		GLM_FUNC_DECL tvec2<T> & operator-=(tvec2<U> const & v);
 		template <typename U> 
-		GLM_FUNC_DECL tvec2<T> & operator*=(U const & s);
+		GLM_FUNC_DECL tvec2<T> & operator*=(U s);
 		template <typename U> 
 		GLM_FUNC_DECL tvec2<T> & operator*=(tvec2<U> const & v);
 		template <typename U> 
-		GLM_FUNC_DECL tvec2<T> & operator/=(U const & s);
+		GLM_FUNC_DECL tvec2<T> & operator/=(U s);
 		template <typename U> 
 		GLM_FUNC_DECL tvec2<T> & operator/=(tvec2<U> const & v);
 		GLM_FUNC_DECL tvec2<T> & operator++();
@@ -187,27 +187,27 @@ namespace detail
 		// Unary bit operators
 
 		template <typename U> 
-		GLM_FUNC_DECL tvec2<T> & operator%= (U const & s);
+		GLM_FUNC_DECL tvec2<T> & operator%= (U s);
 		template <typename U> 
 		GLM_FUNC_DECL tvec2<T> & operator%= (tvec2<U> const & v);
 		template <typename U> 
-		GLM_FUNC_DECL tvec2<T> & operator&= (U const & s);
+		GLM_FUNC_DECL tvec2<T> & operator&= (U s);
 		template <typename U> 
 		GLM_FUNC_DECL tvec2<T> & operator&= (tvec2<U> const & v);
 		template <typename U> 
-		GLM_FUNC_DECL tvec2<T> & operator|= (U const & s);
+		GLM_FUNC_DECL tvec2<T> & operator|= (U s);
 		template <typename U> 
 		GLM_FUNC_DECL tvec2<T> & operator|= (tvec2<U> const & v);
 		template <typename U> 
-		GLM_FUNC_DECL tvec2<T> & operator^= (U const & s);
+		GLM_FUNC_DECL tvec2<T> & operator^= (U s);
 		template <typename U> 
 		GLM_FUNC_DECL tvec2<T> & operator^= (tvec2<U> const & v);
 		template <typename U> 
-		GLM_FUNC_DECL tvec2<T> & operator<<=(U const & s);
+		GLM_FUNC_DECL tvec2<T> & operator<<=(U s);
 		template <typename U> 
 		GLM_FUNC_DECL tvec2<T> & operator<<=(tvec2<U> const & v);
 		template <typename U> 
-		GLM_FUNC_DECL tvec2<T> & operator>>=(U const & s);
+		GLM_FUNC_DECL tvec2<T> & operator>>=(U s);
 		template <typename U> 
 		GLM_FUNC_DECL tvec2<T> & operator>>=(tvec2<U> const & v);
 

+ 10 - 40
glm/core/type_vec2.inl

@@ -204,10 +204,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator+=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator+=(U s)
 	{
 		this->x += T(s);
 		this->y += T(s);
@@ -228,10 +225,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator-=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator-=(U s)
 	{
 		this->x -= T(s);
 		this->y -= T(s);
@@ -252,10 +246,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator*=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator*=(U s)
 	{
 		this->x *= T(s);
 		this->y *= T(s);
@@ -276,10 +267,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator/=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator/=(U s)
 	{
 		this->x /= T(s);
 		this->y /= T(s);
@@ -342,10 +330,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator%=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator%=(U s)
 	{
 		this->x %= T(s);
 		this->y %= T(s);
@@ -366,10 +351,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator&=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator&=(U s)
 	{
 		this->x &= T(s);
 		this->y &= T(s);
@@ -390,10 +372,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator|=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator|=(U s)
 	{
 		this->x |= T(s);
 		this->y |= T(s);
@@ -414,10 +393,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator^=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator^=(U s)
 	{
 		this->x ^= T(s);
 		this->y ^= T(s);
@@ -438,10 +414,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator<<=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator<<=(U s)
 	{
 		this->x <<= T(s);
 		this->y <<= T(s);
@@ -462,10 +435,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator>>=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec2<T> & tvec2<T>::operator>>=(U s)
 	{
 		this->x >>= T(s);
 		this->y >>= T(s);

+ 10 - 10
glm/core/type_vec3.hpp

@@ -189,19 +189,19 @@ namespace detail
 		GLM_FUNC_DECL tvec3<T> & operator= (tvec3<U> const & v);
 
 		template <typename U> 
-		GLM_FUNC_DECL tvec3<T> & operator+=(U const & s);
+		GLM_FUNC_DECL tvec3<T> & operator+=(U s);
 		template <typename U> 
 		GLM_FUNC_DECL tvec3<T> & operator+=(tvec3<U> const & v);
 		template <typename U> 
-		GLM_FUNC_DECL tvec3<T> & operator-=(U const & s);
+		GLM_FUNC_DECL tvec3<T> & operator-=(U s);
 		template <typename U> 
 		GLM_FUNC_DECL tvec3<T> & operator-=(tvec3<U> const & v);
 		template <typename U> 
-		GLM_FUNC_DECL tvec3<T> & operator*=(U const & s);
+		GLM_FUNC_DECL tvec3<T> & operator*=(U s);
 		template <typename U> 
 		GLM_FUNC_DECL tvec3<T> & operator*=(tvec3<U> const & v);
 		template <typename U> 
-		GLM_FUNC_DECL tvec3<T> & operator/=(U const & s);
+		GLM_FUNC_DECL tvec3<T> & operator/=(U s);
 		template <typename U> 
 		GLM_FUNC_DECL tvec3<T> & operator/=(tvec3<U> const & v);
 		GLM_FUNC_DECL tvec3<T> & operator++();
@@ -211,27 +211,27 @@ namespace detail
 		// Unary bit operators
 
 		template <typename U>
-		GLM_FUNC_DECL tvec3<T> & operator%= (U const & s);
+		GLM_FUNC_DECL tvec3<T> & operator%= (U s);
 		template <typename U>
 		GLM_FUNC_DECL tvec3<T> & operator%= (tvec3<U> const & v);
 		template <typename U>
-		GLM_FUNC_DECL tvec3<T> & operator&= (U const & s);
+		GLM_FUNC_DECL tvec3<T> & operator&= (U s);
 		template <typename U>
 		GLM_FUNC_DECL tvec3<T> & operator&= (tvec3<U> const & v);
 		template <typename U>
-		GLM_FUNC_DECL tvec3<T> & operator|= (U const & s);
+		GLM_FUNC_DECL tvec3<T> & operator|= (U s);
 		template <typename U>
 		GLM_FUNC_DECL tvec3<T> & operator|= (tvec3<U> const & v);
 		template <typename U>
-		GLM_FUNC_DECL tvec3<T> & operator^= (U const & s);
+		GLM_FUNC_DECL tvec3<T> & operator^= (U s);
 		template <typename U>
 		GLM_FUNC_DECL tvec3<T> & operator^= (tvec3<U> const & v);
 		template <typename U>
-		GLM_FUNC_DECL tvec3<T> & operator<<=(U const & s);
+		GLM_FUNC_DECL tvec3<T> & operator<<=(U s);
 		template <typename U>
 		GLM_FUNC_DECL tvec3<T> & operator<<=(tvec3<U> const & v);
 		template <typename U>
-		GLM_FUNC_DECL tvec3<T> & operator>>=(U const & s);
+		GLM_FUNC_DECL tvec3<T> & operator>>=(U s);
 		template <typename U>
 		GLM_FUNC_DECL tvec3<T> & operator>>=(tvec3<U> const & v);
 

+ 10 - 40
glm/core/type_vec3.inl

@@ -255,10 +255,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator+=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator+=(U s)
 	{
 		this->x += T(s);
 		this->y += T(s);
@@ -281,10 +278,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator-=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator-=(U s)
 	{
 		this->x -= T(s);
 		this->y -= T(s);
@@ -307,10 +301,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator*=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator*=(U s)
 	{
 		this->x *= T(s);
 		this->y *= T(s);
@@ -333,10 +324,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator/=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator/=(U s)
 	{
 		this->x /= T(s);
 		this->y /= T(s);
@@ -403,10 +391,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator%=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator%=(U s)
 	{
 		this->x %= s;
 		this->y %= s;
@@ -429,10 +414,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator&=
-	(	
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator&=(U s)
 	{
 		this->x &= s;
 		this->y &= s;
@@ -455,10 +437,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator|=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator|=(U s)
 	{
 		this->x |= s;
 		this->y |= s;
@@ -481,10 +460,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator^=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator^=(U s)
 	{
 		this->x ^= s;
 		this->y ^= s;
@@ -507,10 +483,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator<<=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator<<=(U s)
 	{
 		this->x <<= s;
 		this->y <<= s;
@@ -533,10 +506,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator>>=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator>>=(U s)
 	{
 		this->x >>= T(s);
 		this->y >>= T(s);

+ 10 - 10
glm/core/type_vec4.hpp

@@ -244,19 +244,19 @@ namespace detail
 		GLM_FUNC_DECL tvec4<T> & operator= (tvec4<U> const & v);
 
 		template <typename U>
-		GLM_FUNC_DECL tvec4<T> & operator+=(U const & s);
+		GLM_FUNC_DECL tvec4<T> & operator+=(U s);
 		template <typename U>
 		GLM_FUNC_DECL tvec4<T> & operator+=(tvec4<U> const & v);
 		template <typename U>
-		GLM_FUNC_DECL tvec4<T> & operator-=(U const & s);
+		GLM_FUNC_DECL tvec4<T> & operator-=(U s);
 		template <typename U>
 		GLM_FUNC_DECL tvec4<T> & operator-=(tvec4<U> const & v);
 		template <typename U>
-		GLM_FUNC_DECL tvec4<T> & operator*=(U const & s);
+		GLM_FUNC_DECL tvec4<T> & operator*=(U s);
 		template <typename U>
 		GLM_FUNC_DECL tvec4<T> & operator*=(tvec4<U> const & v);
 		template <typename U>
-		GLM_FUNC_DECL tvec4<T> & operator/=(U const & s);
+		GLM_FUNC_DECL tvec4<T> & operator/=(U s);
 		template <typename U>
 		GLM_FUNC_DECL tvec4<T> & operator/=(tvec4<U> const & v);
 		GLM_FUNC_DECL tvec4<T> & operator++();
@@ -266,27 +266,27 @@ namespace detail
 		// Unary bit operators
 
 		template <typename U>
-		GLM_FUNC_DECL tvec4<T> & operator%= (U const & s);
+		GLM_FUNC_DECL tvec4<T> & operator%= (U s);
 		template <typename U>
 		GLM_FUNC_DECL tvec4<T> & operator%= (tvec4<U> const & v);
 		template <typename U>
-		GLM_FUNC_DECL tvec4<T> & operator&= (U const & s);
+		GLM_FUNC_DECL tvec4<T> & operator&= (U s);
 		template <typename U>
 		GLM_FUNC_DECL tvec4<T> & operator&= (tvec4<U> const & v);
 		template <typename U>
-		GLM_FUNC_DECL tvec4<T> & operator|= (U const & s);
+		GLM_FUNC_DECL tvec4<T> & operator|= (U s);
 		template <typename U>
 		GLM_FUNC_DECL tvec4<T> & operator|= (tvec4<U> const & v);
 		template <typename U>
-		GLM_FUNC_DECL tvec4<T> & operator^= (U const & s);
+		GLM_FUNC_DECL tvec4<T> & operator^= (U s);
 		template <typename U>
 		GLM_FUNC_DECL tvec4<T> & operator^= (tvec4<U> const & v);
 		template <typename U>
-		GLM_FUNC_DECL tvec4<T> & operator<<=(U const & s);
+		GLM_FUNC_DECL tvec4<T> & operator<<=(U s);
 		template <typename U>
 		GLM_FUNC_DECL tvec4<T> & operator<<=(tvec4<U> const & v);
 		template <typename U>
-		GLM_FUNC_DECL tvec4<T> & operator>>=(U const & s);
+		GLM_FUNC_DECL tvec4<T> & operator>>=(U s);
 		template <typename U>
 		GLM_FUNC_DECL tvec4<T> & operator>>=(tvec4<U> const & v);
 

+ 10 - 40
glm/core/type_vec4.inl

@@ -396,10 +396,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator+=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator+= (U s)
 	{
 		this->x += T(s);
 		this->y += T(s);
@@ -424,10 +421,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator-=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator-= (U s)
 	{
 		this->x -= T(s);
 		this->y -= T(s);
@@ -452,10 +446,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator*=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator*= (U s)
 	{
 		this->x *= T(s);
 		this->y *= T(s);
@@ -480,10 +471,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator/=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator/= (U s)
 	{
 		this->x /= T(s);
 		this->y /= T(s);
@@ -531,10 +519,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator%=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator%= (U s)
 	{
 		this->x %= T(s);
 		this->y %= T(s);
@@ -559,10 +544,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator&=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator&= (U s)
 	{
 		this->x &= T(s);
 		this->y &= T(s);
@@ -587,10 +569,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator|=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator|= (U s)
 	{
 		this->x |= T(s);
 		this->y |= T(s);
@@ -615,10 +594,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator^=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator^= (U s)
 	{
 		this->x ^= T(s);
 		this->y ^= T(s);
@@ -643,10 +619,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator<<=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator<<= (U s)
 	{
 		this->x <<= T(s);
 		this->y <<= T(s);
@@ -671,10 +644,7 @@ namespace detail
 
 	template <typename T>
 	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator>>=
-	(
-		U const & s
-	)
+	GLM_FUNC_QUALIFIER tvec4<T> & tvec4<T>::operator>>= (U s)
 	{
 		this->x >>= T(s);
 		this->y >>= T(s);

+ 3 - 2
readme.txt

@@ -37,7 +37,7 @@ More informations in GLM manual:
 http://glm.g-truc.net/glm.pdf
 
 ================================================================================
-GLM 0.9.4.6: 2013-09-15
+GLM 0.9.4.6: 2013-09-18
 --------------------------------------------------------------------------------
 - Fixed detection to select the last known compiler if newer version #106
 - Fixed is_int and is_uint code duplication with GCC and C++11 #107 
@@ -45,10 +45,11 @@ GLM 0.9.4.6: 2013-09-15
 - Added c++1y mode support in CMake test suite
 - Removed ms extension mode to CMake when no using Visual C++
 - Added pedantic mode to CMake test suite for Clang and GCC
-- Added use of GCC frontend on Unix for ICC and Visual C++ fronted on Windows 
+- Added use of GCC frontend on Unix for ICC and Visual C++ fronted on Windows
   for ICC
 - Added compilation errors for unsupported compiler versions
 - Fixed glm::orientation with GLM_FORCE_RADIANS defined #112
+- Fixed const ref issue on assignment operator taking a scalar parameter #116
 
 ================================================================================
 GLM 0.9.4.5: 2013-08-12