Added GLM_FORCE_CTOR_INIT #735 #740

This commit is contained in:
Christophe Riccio 2018-03-27 18:23:37 +02:00
parent b1522b5178
commit 8390a77b3a
31 changed files with 127 additions and 43 deletions

View File

@ -720,8 +720,19 @@
#if GLM_HAS_DEFAULTED_FUNCTIONS
# define GLM_DEFAULT = default
# ifdef GLM_FORCE_NO_CTOR_INIT
# undef GLM_FORCE_CTOR_INIT
# endif
# ifdef GLM_FORCE_CTOR_INIT
# define GLM_DEFAULT_CTOR
# else
# define GLM_DEFAULT_CTOR = default
# endif
#else
# define GLM_DEFAULT
# define GLM_DEFAULT_CTOR
#endif
#if GLM_HAS_CONSTEXPR || GLM_HAS_CONSTEXPR_PARTIAL

View File

@ -34,7 +34,7 @@ namespace glm
// -- Constructors --
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat() GLM_DEFAULT;
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat(mat<2, 2, T, Q> const& m) GLM_DEFAULT;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat(mat<2, 2, T, P> const& m);

View File

@ -7,10 +7,15 @@ namespace glm
{
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS
# if !GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT)
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR_CXX14 mat<2, 2, T, Q>::mat()
{}
{
# ifdef GLM_FORCE_CTOR_INIT
this->value[0] = col_type(1, 0);
this->value[1] = col_type(0, 1);
# endif
}
# endif
# if !GLM_HAS_DEFAULTED_FUNCTIONS

View File

@ -35,7 +35,7 @@ namespace glm
// -- Constructors --
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat() GLM_DEFAULT;
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat(mat<2, 3, T, Q> const& m) GLM_DEFAULT;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat(mat<2, 3, T, P> const& m);

View File

@ -5,10 +5,15 @@ namespace glm
{
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS
# if !GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT)
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR_CXX14 mat<2, 3, T, Q>::mat()
{}
{
# ifdef GLM_FORCE_CTOR_INIT
this->value[0] = col_type(1, 0, 0);
this->value[1] = col_type(0, 1, 0);
# endif
}
# endif
# if !GLM_HAS_DEFAULTED_FUNCTIONS

View File

@ -35,7 +35,7 @@ namespace glm
// -- Constructors --
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat() GLM_DEFAULT;
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat(mat<2, 4, T, Q> const& m) GLM_DEFAULT;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat(mat<2, 4, T, P> const& m);

View File

@ -5,10 +5,15 @@ namespace glm
{
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS
# if !GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT)
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR_CXX14 mat<2, 4, T, Q>::mat()
{}
{
# ifdef GLM_FORCE_CTOR_INIT
this->value[0] = col_type(1, 0, 0, 0);
this->value[1] = col_type(0, 1, 0, 0);
# endif
}
# endif
# if !GLM_HAS_DEFAULTED_FUNCTIONS

View File

@ -35,7 +35,7 @@ namespace glm
// -- Constructors --
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat() GLM_DEFAULT;
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat(mat<3, 2, T, Q> const& m) GLM_DEFAULT;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat(mat<3, 2, T, P> const& m);

View File

@ -5,10 +5,16 @@ namespace glm
{
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS
# if !GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT)
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR_CXX14 mat<3, 2, T, Q>::mat()
{}
{
# ifdef GLM_FORCE_CTOR_INIT
this->value[0] = col_type(1, 0);
this->value[1] = col_type(0, 1);
this->value[2] = col_type(0, 0);
# endif
}
# endif
# if !GLM_HAS_DEFAULTED_FUNCTIONS

View File

@ -34,7 +34,7 @@ namespace glm
// -- Constructors --
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat() GLM_DEFAULT;
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat(mat<3, 3, T, Q> const& m) GLM_DEFAULT;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat(mat<3, 3, T, P> const& m);

View File

@ -7,10 +7,16 @@ namespace glm
{
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS
# if !GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT)
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR_CXX14 mat<3, 3, T, Q>::mat()
{}
{
# ifdef GLM_FORCE_CTOR_INIT
this->value[0] = col_type(1, 0, 0);
this->value[1] = col_type(0, 1, 0);
this->value[2] = col_type(0, 0, 1);
# endif
}
# endif
# if !GLM_HAS_DEFAULTED_FUNCTIONS

View File

@ -35,7 +35,7 @@ namespace glm
// -- Constructors --
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat() GLM_DEFAULT;
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat(mat<3, 4, T, Q> const& m) GLM_DEFAULT;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat(mat<3, 4, T, P> const& m);

View File

@ -5,10 +5,16 @@ namespace glm
{
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS
# if !GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT)
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR_CXX14 mat<3, 4, T, Q>::mat()
{}
{
# ifdef GLM_FORCE_CTOR_INIT
this->value[0] = col_type(1, 0, 0, 0);
this->value[1] = col_type(0, 1, 0, 0);
this->value[2] = col_type(0, 0, 1, 0);
# endif
}
# endif
# if !GLM_HAS_DEFAULTED_FUNCTIONS

View File

@ -35,7 +35,7 @@ namespace glm
// -- Constructors --
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat() GLM_DEFAULT;
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat(mat<4, 2, T, Q> const& m) GLM_DEFAULT;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat(mat<4, 2, T, P> const& m);

View File

@ -5,10 +5,17 @@ namespace glm
{
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS
# if !GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT)
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR_CXX14 mat<4, 2, T, Q>::mat()
{}
{
# ifdef GLM_FORCE_CTOR_INIT
this->value[0] = col_type(1, 0);
this->value[1] = col_type(0, 1);
this->value[2] = col_type(0, 0);
this->value[3] = col_type(0, 0);
# endif
}
# endif
# if !GLM_HAS_DEFAULTED_FUNCTIONS

View File

@ -35,7 +35,7 @@ namespace glm
// -- Constructors --
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat() GLM_DEFAULT;
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat(mat<4, 3, T, Q> const& m) GLM_DEFAULT;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat(mat<4, 3, T, P> const& m);

View File

@ -5,10 +5,17 @@ namespace glm
{
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS
# if !GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT)
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR_CXX14 mat<4, 3, T, Q>::mat()
{}
{
# ifdef GLM_FORCE_CTOR_INIT
this->value[0] = col_type(1, 0, 0);
this->value[1] = col_type(0, 1, 0);
this->value[2] = col_type(0, 0, 1);
this->value[3] = col_type(0, 0, 0);
# endif
}
# endif
# if !GLM_HAS_DEFAULTED_FUNCTIONS

View File

@ -34,7 +34,7 @@ namespace glm
// -- Constructors --
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat() GLM_DEFAULT;
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat(mat<4, 4, T, Q> const& m) GLM_DEFAULT;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR_CXX14 mat(mat<4, 4, T, P> const& m);

View File

@ -7,10 +7,17 @@ namespace glm
{
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS
# if !GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT)
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR_CXX14 mat<4, 4, T, Q>::mat()
{}
{
# ifdef GLM_FORCE_CTOR_INIT
this->value[0] = col_type(1, 0, 0, 0);
this->value[1] = col_type(0, 1, 0, 0);
this->value[2] = col_type(0, 0, 1, 0);
this->value[3] = col_type(0, 0, 0, 1);
# endif
}
# endif
# if !GLM_HAS_DEFAULTED_FUNCTIONS

View File

@ -5,11 +5,14 @@ namespace glm
{
// -- Implicit basic constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS
# if !GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT)
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<1, T, Q>::vec()
# ifdef GLM_FORCE_CTOR_INIT
: x(0)
# endif
{}
# endif//!GLM_HAS_DEFAULTED_FUNCTIONS
# endif//!GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT)
# if !GLM_HAS_DEFAULTED_FUNCTIONS
template<typename T, qualifier Q>

View File

@ -86,7 +86,7 @@ namespace glm
// -- Implicit basic constructors --
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec() GLM_DEFAULT;
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec const& v) GLM_DEFAULT;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<2, T, P> const& v);

View File

@ -5,11 +5,14 @@ namespace glm
{
// -- Implicit basic constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS
# if !GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT)
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<2, T, Q>::vec()
# ifdef GLM_FORCE_CTOR_INIT
: x(0), y(0)
# endif
{}
# endif//!GLM_HAS_DEFAULTED_FUNCTIONS
# endif//!GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT)
# if !GLM_HAS_DEFAULTED_FUNCTIONS
template<typename T, qualifier Q>

View File

@ -86,7 +86,7 @@ namespace glm
// -- Implicit basic constructors --
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec() GLM_DEFAULT;
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec const& v) GLM_DEFAULT;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<3, T, P> const& v);

View File

@ -5,11 +5,14 @@ namespace glm
{
// -- Implicit basic constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS
# if !GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT)
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<3, T, Q>::vec()
# ifdef GLM_FORCE_CTOR_INIT
: x(0), y(0), z(0)
# endif
{}
# endif//!GLM_HAS_DEFAULTED_FUNCTIONS
# endif//!GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT)
# if !GLM_HAS_DEFAULTED_FUNCTIONS
template<typename T, qualifier Q>

View File

@ -89,7 +89,7 @@ namespace glm
// -- Implicit basic constructors --
GLM_FUNC_DECL GLM_CONSTEXPR_SIMD vec() GLM_DEFAULT;
GLM_FUNC_DECL GLM_CONSTEXPR_SIMD vec() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL GLM_CONSTEXPR_SIMD vec(vec<4, T, Q> const& v) GLM_DEFAULT;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR_SIMD vec(vec<4, T, P> const& v);

View File

@ -158,11 +158,14 @@ namespace detail
// -- Implicit basic constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS
# if !GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT)
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, T, Q>::vec()
# ifdef GLM_FORCE_CTOR_INIT
: x(0), y(0), z(0), w(0)
# endif
{}
# endif//!GLM_HAS_DEFAULTED_FUNCTIONS
# endif//!GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT)
# if !GLM_HAS_DEFAULTED_FUNCTIONS
template<typename T, qualifier Q>

View File

@ -101,7 +101,7 @@ namespace glm
// -- Implicit basic constructors --
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec() GLM_DEFAULT;
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec const& v) GLM_DEFAULT;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<1, T, P> const& v);

View File

@ -77,7 +77,7 @@ namespace glm
// -- Implicit basic constructors --
GLM_FUNC_DECL GLM_CONSTEXPR tquat() GLM_DEFAULT;
GLM_FUNC_DECL GLM_CONSTEXPR tquat() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL GLM_CONSTEXPR tquat(tquat<T, Q> const& q) GLM_DEFAULT;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR tquat(tquat<T, P> const& q);

View File

@ -85,9 +85,12 @@ namespace detail
// -- Implicit basic constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS
# if !GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT)
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, Q>::tquat()
# ifdef GLM_FORCE_CTOR_INIT
: x(0), y(0), z(0), w(1)
# endif
{}
# endif

View File

@ -56,7 +56,7 @@ namespace glm
// -- Implicit basic constructors --
GLM_FUNC_DECL GLM_CONSTEXPR tdualquat() GLM_DEFAULT;
GLM_FUNC_DECL GLM_CONSTEXPR tdualquat() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tdualquat<T, Q> const& d) GLM_DEFAULT;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tdualquat<T, P> const& d);

View File

@ -24,9 +24,13 @@ namespace glm
// -- Implicit basic constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS
# if !GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT)
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tdualquat<T, Q>::tdualquat()
# ifdef GLM_FORCE_CTOR_INIT
: real(tquat<T, P>())
, dual(tquat<T, P>(0, 0, 0, 0))
# endif
{}
# endif