From 931e72b4568613aa7cd084b56a0908c1fedfb6ba Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 4 Nov 2014 00:52:16 +0100 Subject: [PATCH] Initial std trivial experiments #263 --- glm/detail/setup.hpp | 4 ++++ glm/detail/type_vec4.hpp | 4 ++-- glm/detail/type_vec4.inl | 8 ++++---- test/core/core_type_mat4x4.cpp | 2 ++ test/core/core_type_vec4.cpp | 14 +++++++++++++- 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 78dd193a..578e95ed 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -527,6 +527,10 @@ ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \ __has_feature(cxx_range_for)) +#define GLM_HAS_ASSIGNABLE ( \ + (GLM_LANG & GLM_LANG_CXX11_FLAG) || \ + ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC49))) + // OpenMP #ifdef _OPENMP # if GLM_COMPILER & GLM_COMPILER_GCC diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index f92b6a38..eae3d3e4 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -148,7 +148,7 @@ namespace detail // Implicit basic constructors GLM_FUNC_DECL tvec4(); - GLM_FUNC_DECL tvec4(tvec4 const & v); + //GLM_FUNC_DECL tvec4(tvec4 const & v); template GLM_FUNC_DECL tvec4(tvec4 const & v); @@ -258,7 +258,7 @@ namespace detail ////////////////////////////////////// // Unary arithmetic operators - GLM_FUNC_DECL tvec4 & operator=(tvec4 const & v); + //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 04e9b8cf..97ada0b7 100644 --- a/glm/detail/type_vec4.inl +++ b/glm/detail/type_vec4.inl @@ -84,7 +84,7 @@ namespace glm # endif {} #endif - +/* template GLM_FUNC_QUALIFIER tvec4::tvec4(tvec4 const & v) : x(v.x), y(v.y), z(v.z), w(v.w) @@ -101,7 +101,7 @@ namespace glm : data(v.data) {} #endif - +*/ template template GLM_FUNC_QUALIFIER tvec4::tvec4(tvec4 const & v) @@ -283,7 +283,7 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators - +/* template GLM_FUNC_QUALIFIER tvec4 & tvec4::operator=(tvec4 const & v) { @@ -309,7 +309,7 @@ namespace glm return *this; } #endif - +*/ template template GLM_FUNC_QUALIFIER tvec4 & tvec4::operator=(tvec4 const & v) diff --git a/test/core/core_type_mat4x4.cpp b/test/core/core_type_mat4x4.cpp index bda125c0..a7a94ed7 100644 --- a/test/core/core_type_mat4x4.cpp +++ b/test/core/core_type_mat4x4.cpp @@ -188,6 +188,8 @@ int test_ctr() { int Error(0); + Error += std::is_copy_constructible::value ? 0 : 1; + #if(GLM_HAS_INITIALIZER_LISTS) glm::mat4 m0( glm::vec4(0, 1, 2, 3), diff --git a/test/core/core_type_vec4.cpp b/test/core/core_type_vec4.cpp index 0c5e92ff..4a308883 100644 --- a/test/core/core_type_vec4.cpp +++ b/test/core/core_type_vec4.cpp @@ -42,7 +42,19 @@ enum comp int test_vec4_ctor() { int Error = 0; - + + glm::ivec4 A(1, 2, 3, 4); + glm::ivec4 B(A); + Error += glm::all(glm::equal(A, B)) ? 0 : 1; + + Error += std::is_trivially_copy_assignable::value ? 0 : 1; + Error += std::is_trivially_copyable::value ? 0 : 1; + Error += std::is_trivially_copy_assignable::value ? 0 : 1; + Error += std::is_trivially_copyable::value ? 0 : 1; + + Error += std::has_trivial_copy_constructor::value ? 0 : 1; + Error += std::is_copy_constructible::value ? 0 : 1; + #if GLM_HAS_INITIALIZER_LISTS { glm::vec4 a{ 0, 1, 2, 3 };