Change the logic of defaulted constructors

Defaulted functions should not impact the constructor if the user
requests GLM_FORCE_CTOR_INIT.
This commit is contained in:
Amaury Le Leyzour 2020-09-02 11:45:26 -07:00
parent b3f8772026
commit b43fa52360
29 changed files with 47 additions and 29 deletions

View File

@ -806,7 +806,7 @@ namespace detail
///////////////////////////////////////////////////////////////////////////////////
// Configure the use of defaulted function
#if GLM_HAS_DEFAULTED_FUNCTIONS && GLM_CONFIG_CTOR_INIT == GLM_CTOR_INIT_DISABLE
#if GLM_HAS_DEFAULTED_FUNCTIONS
# define GLM_CONFIG_DEFAULTED_FUNCTIONS GLM_ENABLE
# define GLM_DEFAULT = default
#else
@ -814,6 +814,14 @@ namespace detail
# define GLM_DEFAULT
#endif
#if GLM_CONFIG_CTOR_INIT == GLM_CTOR_INIT_DISABLE && GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_ENABLE
# define GLM_CONFIG_DEFAULTED_DEFAULT_CTOR GLM_ENABLE
# define GLM_DEFAULT_CTOR GLM_DEFAULT
#else
# define GLM_CONFIG_DEFAULTED_DEFAULT_CTOR GLM_DISABLE
# define GLM_DEFAULT_CTOR
#endif
///////////////////////////////////////////////////////////////////////////////////
// Configure the use of aligned gentypes

View File

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

View File

@ -4,7 +4,7 @@ namespace glm
{
// -- Constructors --
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_DISABLE
# if GLM_CONFIG_DEFAULTED_DEFAULT_CTOR == GLM_DISABLE
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 2, T, Q>::mat()
# if GLM_CONFIG_CTOR_INIT == GLM_CTOR_INITIALIZER_LIST

View File

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

View File

@ -2,7 +2,7 @@ namespace glm
{
// -- Constructors --
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_DISABLE
# if GLM_CONFIG_DEFAULTED_DEFAULT_CTOR == GLM_DISABLE
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 3, T, Q>::mat()
# if GLM_CONFIG_CTOR_INIT == GLM_CTOR_INITIALIZER_LIST

View File

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

View File

@ -2,7 +2,7 @@ namespace glm
{
// -- Constructors --
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_DISABLE
# if GLM_CONFIG_DEFAULTED_DEFAULT_CTOR == GLM_DISABLE
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 4, T, Q>::mat()
# if GLM_CONFIG_CTOR_INIT == GLM_CTOR_INITIALIZER_LIST

View File

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

View File

@ -2,7 +2,7 @@ namespace glm
{
// -- Constructors --
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_DISABLE
# if GLM_CONFIG_DEFAULTED_DEFAULT_CTOR == GLM_DISABLE
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q>::mat()
# if GLM_CONFIG_CTOR_INIT == GLM_CTOR_INITIALIZER_LIST

View File

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

View File

@ -4,7 +4,7 @@ namespace glm
{
// -- Constructors --
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_DISABLE
# if GLM_CONFIG_DEFAULTED_DEFAULT_CTOR == GLM_DISABLE
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, T, Q>::mat()
# if GLM_CONFIG_CTOR_INIT == GLM_CTOR_INITIALIZER_LIST

View File

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

View File

@ -2,7 +2,7 @@ namespace glm
{
// -- Constructors --
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_DISABLE
# if GLM_CONFIG_DEFAULTED_DEFAULT_CTOR == GLM_DISABLE
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 4, T, Q>::mat()
# if GLM_CONFIG_CTOR_INIT == GLM_CTOR_INITIALIZER_LIST

View File

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

View File

@ -2,7 +2,7 @@ namespace glm
{
// -- Constructors --
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_DISABLE
# if GLM_CONFIG_DEFAULTED_DEFAULT_CTOR == GLM_DISABLE
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 2, T, Q>::mat()
# if GLM_CONFIG_CTOR_INIT == GLM_CTOR_INITIALIZER_LIST

View File

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

View File

@ -2,7 +2,7 @@ namespace glm
{
// -- Constructors --
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_DISABLE
# if GLM_CONFIG_DEFAULTED_DEFAULT_CTOR == GLM_DISABLE
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 3, T, Q>::mat()
# if GLM_CONFIG_CTOR_INIT == GLM_CTOR_INITIALIZER_LIST

View File

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

View File

@ -4,7 +4,7 @@ namespace glm
{
// -- Constructors --
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_DISABLE
# if GLM_CONFIG_DEFAULTED_DEFAULT_CTOR == GLM_DISABLE
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q>::mat()
# if GLM_CONFIG_CTOR_INIT == GLM_CTOR_INITIALIZER_LIST

View File

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

View File

@ -94,7 +94,7 @@ namespace detail
// -- Implicit basic constructors --
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_DISABLE
# if GLM_CONFIG_DEFAULTED_DEFAULT_CTOR == GLM_DISABLE
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua<T, Q>::qua()
# if GLM_CONFIG_CTOR_INIT != GLM_CTOR_INIT_DISABLE
@ -105,7 +105,9 @@ namespace detail
# endif
# endif
{}
# endif
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_DISABLE
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua<T, Q>::qua(qua<T, Q> const& q)
# ifdef GLM_FORCE_QUAT_DATA_WXYZ

View File

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

View File

@ -6,14 +6,16 @@ namespace glm
{
// -- Implicit basic constructors --
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_DISABLE
# if GLM_CONFIG_DEFAULTED_DEFAULT_CTOR == GLM_DISABLE
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<1, T, Q>::vec()
# if GLM_CONFIG_CTOR_INIT != GLM_CTOR_INIT_DISABLE
: x(0)
# endif
{}
# endif
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_DISABLE
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<1, T, Q>::vec(vec<1, T, Q> const& v)
: x(v.x)

View File

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

View File

@ -6,14 +6,16 @@ namespace glm
{
// -- Implicit basic constructors --
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_DISABLE
# if GLM_CONFIG_DEFAULTED_DEFAULT_CTOR == GLM_DISABLE
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q>::vec()
# if GLM_CONFIG_CTOR_INIT != GLM_CTOR_INIT_DISABLE
: x(0), y(0)
# endif
{}
# endif
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_DISABLE
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q>::vec(vec<2, T, Q> const& v)
: x(v.x), y(v.y)

View File

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

View File

@ -6,14 +6,16 @@ namespace glm
{
// -- Implicit basic constructors --
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_DISABLE
# if GLM_CONFIG_DEFAULTED_DEFAULT_CTOR == GLM_DISABLE
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<3, T, Q>::vec()
# if GLM_CONFIG_CTOR_INIT != GLM_CTOR_INIT_DISABLE
: x(0), y(0), z(0)
# endif
{}
# endif
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_DISABLE
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<3, T, Q>::vec(vec<3, T, Q> const& v)
: x(v.x), y(v.y), z(v.z)

View File

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

View File

@ -129,14 +129,16 @@ namespace detail
// -- Implicit basic constructors --
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_DISABLE
# if GLM_CONFIG_DEFAULTED_DEFAULT_CTOR == GLM_DISABLE
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, T, Q>::vec()
# if GLM_CONFIG_CTOR_INIT != GLM_CTOR_INIT_DISABLE
: x(0), y(0), z(0), w(0)
# endif
{}
# endif
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_DISABLE
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, T, Q>::vec(vec<4, T, Q> const& v)
: x(v.x), y(v.y), z(v.z), w(v.w)