From 56917bf17c1e3002b3cd40b66634ee3fb381fbd3 Mon Sep 17 00:00:00 2001 From: Patrik Huber Date: Thu, 18 Aug 2016 00:01:41 +0100 Subject: [PATCH] Removed use of =default for vector types Defaulting the copy constructor and copy assignment operators causes compiler errors when the type T is not trivially copyable. In that case, explicitly defined copy ctor and assignment are required. This PR removes the #ifdefs around the existing operators, so they're always used. --- glm/detail/type_vec1.hpp | 4 ++-- glm/detail/type_vec1.inl | 24 ++++++++++-------------- glm/detail/type_vec2.hpp | 4 ++-- glm/detail/type_vec2.inl | 26 +++++++++++--------------- glm/detail/type_vec3.hpp | 4 ++-- glm/detail/type_vec3.inl | 28 ++++++++++++---------------- glm/detail/type_vec4.hpp | 4 ++-- glm/detail/type_vec4.inl | 30 +++++++++++++----------------- 8 files changed, 54 insertions(+), 70 deletions(-) diff --git a/glm/detail/type_vec1.hpp b/glm/detail/type_vec1.hpp index fe55cd22..a6666d33 100644 --- a/glm/detail/type_vec1.hpp +++ b/glm/detail/type_vec1.hpp @@ -83,7 +83,7 @@ namespace glm // -- Implicit basic constructors -- GLM_FUNC_DECL GLM_CONSTEXPR tvec1() GLM_DEFAULT_CTOR; - GLM_FUNC_DECL GLM_CONSTEXPR tvec1(tvec1 const & v) GLM_DEFAULT; + GLM_FUNC_DECL GLM_CONSTEXPR tvec1(tvec1 const & v); template GLM_FUNC_DECL GLM_CONSTEXPR tvec1(tvec1 const & v); @@ -120,7 +120,7 @@ namespace glm */ // -- Unary arithmetic operators -- - GLM_FUNC_DECL tvec1 & operator=(tvec1 const & v) GLM_DEFAULT; + GLM_FUNC_DECL tvec1 & operator=(tvec1 const & v); template GLM_FUNC_DECL tvec1 & operator=(tvec1 const & v); diff --git a/glm/detail/type_vec1.inl b/glm/detail/type_vec1.inl index 56f6b25b..facec31e 100644 --- a/glm/detail/type_vec1.inl +++ b/glm/detail/type_vec1.inl @@ -14,12 +14,10 @@ namespace glm {} # endif//!GLM_HAS_DEFAULTED_FUNCTIONS -# if !GLM_HAS_DEFAULTED_FUNCTIONS - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec1::tvec1(tvec1 const & v) - : x(v.x) - {} -# endif//!GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec1::tvec1(tvec1 const & v) + : x(v.x) + {} template template @@ -88,14 +86,12 @@ namespace glm // -- Unary arithmetic operators -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS - template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator=(tvec1 const & v) - { - this->x = v.x; - return *this; - } -# endif//!GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator=(tvec1 const & v) + { + this->x = v.x; + return *this; + } template template diff --git a/glm/detail/type_vec2.hpp b/glm/detail/type_vec2.hpp index 331782dd..cb849639 100644 --- a/glm/detail/type_vec2.hpp +++ b/glm/detail/type_vec2.hpp @@ -84,7 +84,7 @@ namespace glm // -- Implicit basic constructors -- GLM_FUNC_DECL GLM_CONSTEXPR tvec2() GLM_DEFAULT_CTOR; - GLM_FUNC_DECL GLM_CONSTEXPR tvec2(tvec2 const& v) GLM_DEFAULT; + GLM_FUNC_DECL GLM_CONSTEXPR tvec2(tvec2 const& v); template GLM_FUNC_DECL GLM_CONSTEXPR tvec2(tvec2 const& v); @@ -126,7 +126,7 @@ namespace glm // -- Unary arithmetic operators -- - GLM_FUNC_DECL tvec2& operator=(tvec2 const & v) GLM_DEFAULT; + GLM_FUNC_DECL tvec2& operator=(tvec2 const & v); template GLM_FUNC_DECL tvec2& operator=(tvec2 const & v); diff --git a/glm/detail/type_vec2.inl b/glm/detail/type_vec2.inl index d10f96e6..747886cf 100644 --- a/glm/detail/type_vec2.inl +++ b/glm/detail/type_vec2.inl @@ -27,12 +27,10 @@ namespace glm {} # endif//!GLM_HAS_DEFAULTED_FUNCTIONS -# if !GLM_HAS_DEFAULTED_FUNCTIONS - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2::tvec2(tvec2 const & v) - : x(v.x), y(v.y) - {} -# endif//!GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2::tvec2(tvec2 const & v) + : x(v.x), y(v.y) + {} template template @@ -119,15 +117,13 @@ namespace glm // -- Unary arithmetic operators -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator=(tvec2 const & v) - { - this->x = v.x; - this->y = v.y; - return *this; - } -# endif//!GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator=(tvec2 const & v) + { + this->x = v.x; + this->y = v.y; + return *this; + } template template diff --git a/glm/detail/type_vec3.hpp b/glm/detail/type_vec3.hpp index f90ad3c6..30eca666 100644 --- a/glm/detail/type_vec3.hpp +++ b/glm/detail/type_vec3.hpp @@ -84,7 +84,7 @@ namespace glm // -- Implicit basic constructors -- GLM_FUNC_DECL GLM_CONSTEXPR tvec3() GLM_DEFAULT_CTOR; - GLM_FUNC_DECL GLM_CONSTEXPR tvec3(tvec3 const & v) GLM_DEFAULT; + GLM_FUNC_DECL GLM_CONSTEXPR tvec3(tvec3 const & v); template GLM_FUNC_DECL GLM_CONSTEXPR tvec3(tvec3 const & v); @@ -147,7 +147,7 @@ namespace glm // -- Unary arithmetic operators -- - GLM_FUNC_DECL tvec3 & operator=(tvec3 const & v) GLM_DEFAULT; + GLM_FUNC_DECL tvec3 & operator=(tvec3 const & v); template GLM_FUNC_DECL tvec3 & operator=(tvec3 const & v); diff --git a/glm/detail/type_vec3.inl b/glm/detail/type_vec3.inl index cc0424fb..895f06dd 100644 --- a/glm/detail/type_vec3.inl +++ b/glm/detail/type_vec3.inl @@ -40,12 +40,10 @@ namespace glm {} # endif//!GLM_HAS_DEFAULTED_FUNCTIONS -# if !GLM_HAS_DEFAULTED_FUNCTIONS - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec3::tvec3(tvec3 const & v) - : x(v.x), y(v.y), z(v.z) - {} -# endif//!GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec3::tvec3(tvec3 const & v) + : x(v.x), y(v.y), z(v.z) + {} template template @@ -161,16 +159,14 @@ namespace glm // -- Unary arithmetic operators -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS - template - GLM_FUNC_QUALIFIER tvec3& tvec3::operator=(tvec3 const & v) - { - this->x = v.x; - this->y = v.y; - this->z = v.z; - return *this; - } -# endif//!GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER tvec3& tvec3::operator=(tvec3 const & v) + { + this->x = v.x; + this->y = v.y; + this->z = v.z; + return *this; + } template template diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index e74865bd..e0fafbf0 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -87,7 +87,7 @@ namespace glm // -- Implicit basic constructors -- GLM_FUNC_DECL GLM_CONSTEXPR tvec4() GLM_DEFAULT_CTOR; - GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec4 const& v) GLM_DEFAULT; + GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec4 const& v); template GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec4 const& v); @@ -192,7 +192,7 @@ namespace glm // -- Unary arithmetic operators -- - GLM_FUNC_DECL tvec4 & operator=(tvec4 const & v) GLM_DEFAULT; + GLM_FUNC_DECL tvec4 & operator=(tvec4 const & v); template GLM_FUNC_DECL tvec4 & operator=(tvec4 const & v); diff --git a/glm/detail/type_vec4.inl b/glm/detail/type_vec4.inl index d891e038..16e7e4fc 100644 --- a/glm/detail/type_vec4.inl +++ b/glm/detail/type_vec4.inl @@ -163,12 +163,10 @@ namespace detail {} # endif//!GLM_HAS_DEFAULTED_FUNCTIONS -# if !GLM_HAS_DEFAULTED_FUNCTIONS - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec4::tvec4(tvec4 const & v) - : x(v.x), y(v.y), z(v.z), w(v.w) - {} -# endif//!GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec4::tvec4(tvec4 const & v) + : x(v.x), y(v.y), z(v.z), w(v.w) + {} template template @@ -346,17 +344,15 @@ namespace detail // -- Unary arithmetic operators -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS - template - GLM_FUNC_QUALIFIER tvec4& tvec4::operator=(tvec4 const & v) - { - this->x = v.x; - this->y = v.y; - this->z = v.z; - this->w = v.w; - return *this; - } -# endif//!GLM_HAS_DEFAULTED_FUNCTIONS + template + GLM_FUNC_QUALIFIER tvec4& tvec4::operator=(tvec4 const & v) + { + this->x = v.x; + this->y = v.y; + this->z = v.z; + this->w = v.w; + return *this; + } template template