- Added constexpr for *vec*, *mat*, *quat* and *dual_quat* types #493

This commit is contained in:
Christophe Riccio 2016-05-05 15:06:03 +02:00
parent 7e86e9bc3c
commit 6d302792ab
29 changed files with 37 additions and 35 deletions

View File

@ -723,15 +723,17 @@
# define GLM_DEFAULT_CTOR # define GLM_DEFAULT_CTOR
#endif #endif
#if GLM_HAS_CONSTEXPR_PARTIAL #if GLM_HAS_CONSTEXPR
# define GLM_CONSTEXPR constexpr # define GLM_CONSTEXPR constexpr
# define GLM_CONSTEXPR_CTOR constexpr
# define GLM_RELAXED_CONSTEXPR constexpr
#elif GLM_HAS_CONSTEXPR_PARTIAL
# define GLM_CONSTEXPR constexpr
# define GLM_CONSTEXPR_CTOR
# define GLM_RELAXED_CONSTEXPR const
#else #else
# define GLM_CONSTEXPR # define GLM_CONSTEXPR
#endif # define GLM_CONSTEXPR_CTOR
#if GLM_HAS_CONSTEXPR
# define GLM_RELAXED_CONSTEXPR constexpr
#else
# define GLM_RELAXED_CONSTEXPR const # define GLM_RELAXED_CONSTEXPR const
#endif #endif

View File

@ -60,7 +60,7 @@ namespace glm
template <precision Q> template <precision Q>
GLM_FUNC_DECL tmat2x2(tmat2x2<T, Q> const & m); GLM_FUNC_DECL tmat2x2(tmat2x2<T, Q> const & m);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tmat2x2(ctor); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tmat2x2(ctor);
GLM_FUNC_DECL explicit tmat2x2(T scalar); GLM_FUNC_DECL explicit tmat2x2(T scalar);
GLM_FUNC_DECL tmat2x2( GLM_FUNC_DECL tmat2x2(
T const & x1, T const & y1, T const & x1, T const & y1,

View File

@ -81,7 +81,7 @@ namespace detail
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat2x2<T, P>::tmat2x2(ctor) GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tmat2x2<T, P>::tmat2x2(ctor)
{} {}
template <typename T, precision P> template <typename T, precision P>

View File

@ -61,7 +61,7 @@ namespace glm
template <precision Q> template <precision Q>
GLM_FUNC_DECL tmat2x3(tmat2x3<T, Q> const & m); GLM_FUNC_DECL tmat2x3(tmat2x3<T, Q> const & m);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tmat2x3(ctor); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tmat2x3(ctor);
GLM_FUNC_DECL explicit tmat2x3(T scalar); GLM_FUNC_DECL explicit tmat2x3(T scalar);
GLM_FUNC_DECL tmat2x3( GLM_FUNC_DECL tmat2x3(
T x0, T y0, T z0, T x0, T y0, T z0,

View File

@ -63,7 +63,7 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat2x3<T, P>::tmat2x3(ctor) GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tmat2x3<T, P>::tmat2x3(ctor)
{} {}
template <typename T, precision P> template <typename T, precision P>

View File

@ -61,7 +61,7 @@ namespace glm
template <precision Q> template <precision Q>
GLM_FUNC_DECL tmat2x4(tmat2x4<T, Q> const & m); GLM_FUNC_DECL tmat2x4(tmat2x4<T, Q> const & m);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tmat2x4(ctor); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tmat2x4(ctor);
GLM_FUNC_DECL explicit tmat2x4(T scalar); GLM_FUNC_DECL explicit tmat2x4(T scalar);
GLM_FUNC_DECL tmat2x4( GLM_FUNC_DECL tmat2x4(
T x0, T y0, T z0, T w0, T x0, T y0, T z0, T w0,

View File

@ -63,7 +63,7 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat2x4<T, P>::tmat2x4(ctor) GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tmat2x4<T, P>::tmat2x4(ctor)
{} {}
template <typename T, precision P> template <typename T, precision P>

View File

@ -61,7 +61,7 @@ namespace glm
template <precision Q> template <precision Q>
GLM_FUNC_DECL tmat3x2(tmat3x2<T, Q> const & m); GLM_FUNC_DECL tmat3x2(tmat3x2<T, Q> const & m);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tmat3x2(ctor); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tmat3x2(ctor);
GLM_FUNC_DECL explicit tmat3x2(T scalar); GLM_FUNC_DECL explicit tmat3x2(T scalar);
GLM_FUNC_DECL tmat3x2( GLM_FUNC_DECL tmat3x2(
T x0, T y0, T x0, T y0,

View File

@ -66,7 +66,7 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat3x2<T, P>::tmat3x2(ctor) GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tmat3x2<T, P>::tmat3x2(ctor)
{} {}
template <typename T, precision P> template <typename T, precision P>

View File

@ -60,7 +60,7 @@ namespace glm
template <precision Q> template <precision Q>
GLM_FUNC_DECL tmat3x3(tmat3x3<T, Q> const & m); GLM_FUNC_DECL tmat3x3(tmat3x3<T, Q> const & m);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tmat3x3(ctor); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tmat3x3(ctor);
GLM_FUNC_DECL explicit tmat3x3(T scalar); GLM_FUNC_DECL explicit tmat3x3(T scalar);
GLM_FUNC_DECL tmat3x3( GLM_FUNC_DECL tmat3x3(
T x0, T y0, T z0, T x0, T y0, T z0,

View File

@ -90,7 +90,7 @@ namespace detail
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat3x3<T, P>::tmat3x3(ctor) GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tmat3x3<T, P>::tmat3x3(ctor)
{} {}
template <typename T, precision P> template <typename T, precision P>

View File

@ -61,7 +61,7 @@ namespace glm
template <precision Q> template <precision Q>
GLM_FUNC_DECL tmat3x4(tmat3x4<T, Q> const & m); GLM_FUNC_DECL tmat3x4(tmat3x4<T, Q> const & m);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tmat3x4(ctor); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tmat3x4(ctor);
GLM_FUNC_DECL explicit tmat3x4(T scalar); GLM_FUNC_DECL explicit tmat3x4(T scalar);
GLM_FUNC_DECL tmat3x4( GLM_FUNC_DECL tmat3x4(
T x0, T y0, T z0, T w0, T x0, T y0, T z0, T w0,

View File

@ -66,7 +66,7 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat3x4<T, P>::tmat3x4(ctor) GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tmat3x4<T, P>::tmat3x4(ctor)
{} {}
template <typename T, precision P> template <typename T, precision P>

View File

@ -61,7 +61,7 @@ namespace glm
template <precision Q> template <precision Q>
GLM_FUNC_DECL tmat4x2(tmat4x2<T, Q> const & m); GLM_FUNC_DECL tmat4x2(tmat4x2<T, Q> const & m);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tmat4x2(ctor); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tmat4x2(ctor);
GLM_FUNC_DECL explicit tmat4x2(T scalar); GLM_FUNC_DECL explicit tmat4x2(T scalar);
GLM_FUNC_DECL tmat4x2( GLM_FUNC_DECL tmat4x2(
T x0, T y0, T x0, T y0,

View File

@ -76,7 +76,7 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat4x2<T, P>::tmat4x2(ctor) GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tmat4x2<T, P>::tmat4x2(ctor)
{} {}
template <typename T, precision P> template <typename T, precision P>

View File

@ -57,11 +57,11 @@ namespace glm
// -- Constructors -- // -- Constructors --
GLM_FUNC_DECL tmat4x3() GLM_DEFAULT_CTOR; GLM_FUNC_DECL tmat4x3() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL GLM_CONSTEXPR tmat4x3(tmat4x3<T, P> const & m) GLM_DEFAULT; GLM_FUNC_DECL tmat4x3(tmat4x3<T, P> const & m) GLM_DEFAULT;
template <precision Q> template <precision Q>
GLM_FUNC_DECL tmat4x3(tmat4x3<T, Q> const & m); GLM_FUNC_DECL tmat4x3(tmat4x3<T, Q> const & m);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tmat4x3(ctor); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tmat4x3(ctor);
GLM_FUNC_DECL explicit tmat4x3(T const & x); GLM_FUNC_DECL explicit tmat4x3(T const & x);
GLM_FUNC_DECL tmat4x3( GLM_FUNC_DECL tmat4x3(
T const & x0, T const & y0, T const & z0, T const & x0, T const & y0, T const & z0,

View File

@ -69,7 +69,7 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat4x3<T, P>::tmat4x3(ctor) GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tmat4x3<T, P>::tmat4x3(ctor)
{} {}
template <typename T, precision P> template <typename T, precision P>

View File

@ -60,7 +60,7 @@ namespace glm
template <precision Q> template <precision Q>
GLM_FUNC_DECL tmat4x4(tmat4x4<T, Q> const & m); GLM_FUNC_DECL tmat4x4(tmat4x4<T, Q> const & m);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tmat4x4(ctor); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tmat4x4(ctor);
GLM_FUNC_DECL explicit tmat4x4(T const & x); GLM_FUNC_DECL explicit tmat4x4(T const & x);
GLM_FUNC_DECL tmat4x4( GLM_FUNC_DECL tmat4x4(
T const & x0, T const & y0, T const & z0, T const & w0, T const & x0, T const & y0, T const & z0, T const & w0,

View File

@ -129,7 +129,7 @@ namespace detail
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tmat4x4<T, P>::tmat4x4(ctor) GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tmat4x4<T, P>::tmat4x4(ctor)
{} {}
template <typename T, precision P> template <typename T, precision P>

View File

@ -101,7 +101,7 @@ namespace glm
// -- Explicit basic constructors -- // -- Explicit basic constructors --
GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec1(ctor); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tvec1(ctor);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec1(T scalar); GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec1(T scalar);
// -- Conversion vector constructors -- // -- Conversion vector constructors --

View File

@ -59,7 +59,7 @@ namespace glm
// -- Explicit basic constructors -- // -- Explicit basic constructors --
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec1<T, P>::tvec1(ctor) GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec1<T, P>::tvec1(ctor)
{} {}
template <typename T, precision P> template <typename T, precision P>

View File

@ -101,7 +101,7 @@ namespace glm
// -- Explicit basic constructors -- // -- Explicit basic constructors --
GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec2(ctor); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tvec2(ctor);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec2(T scalar); GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec2(T scalar);
GLM_FUNC_DECL GLM_CONSTEXPR tvec2(T s1, T s2); GLM_FUNC_DECL GLM_CONSTEXPR tvec2(T s1, T s2);

View File

@ -68,7 +68,7 @@ namespace glm
// -- Explicit basic constructors -- // -- Explicit basic constructors --
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2<T, P>::tvec2(ctor) GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec2<T, P>::tvec2(ctor)
{} {}
template <typename T, precision P> template <typename T, precision P>

View File

@ -102,7 +102,7 @@ namespace glm
// -- Explicit basic constructors -- // -- Explicit basic constructors --
GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec3(ctor); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tvec3(ctor);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec3(T scalar); GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec3(T scalar);
GLM_FUNC_DECL GLM_CONSTEXPR tvec3(T a, T b, T c); GLM_FUNC_DECL GLM_CONSTEXPR tvec3(T a, T b, T c);

View File

@ -85,7 +85,7 @@ namespace glm
// -- Explicit basic constructors -- // -- Explicit basic constructors --
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec3<T, P>::tvec3(ctor) GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec3<T, P>::tvec3(ctor)
{} {}
template <typename T, precision P> template <typename T, precision P>

View File

@ -157,7 +157,7 @@ namespace detail
// -- Explicit basic constructors -- // -- Explicit basic constructors --
GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec4(ctor); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tvec4(ctor);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec4(T scalar); GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec4(T scalar);
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(T a, T b, T c, T d); GLM_FUNC_DECL GLM_CONSTEXPR tvec4(T a, T b, T c, T d);

View File

@ -59,7 +59,7 @@ namespace glm
// -- Explicit basic constructors -- // -- Explicit basic constructors --
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec4<T, P>::tvec4(ctor) GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4<T, P>::tvec4(ctor)
{} {}
template <typename T, precision P> template <typename T, precision P>

View File

@ -89,7 +89,7 @@ namespace glm
// -- Explicit basic constructors -- // -- Explicit basic constructors --
GLM_FUNC_DECL GLM_CONSTEXPR explicit tquat(ctor); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tquat(ctor);
GLM_FUNC_DECL GLM_CONSTEXPR tquat(T const & s, tvec3<T, P> const & v); GLM_FUNC_DECL GLM_CONSTEXPR tquat(T const & s, tvec3<T, P> const & v);
GLM_FUNC_DECL GLM_CONSTEXPR tquat(T const & w, T const & x, T const & y, T const & z); GLM_FUNC_DECL GLM_CONSTEXPR tquat(T const & w, T const & x, T const & y, T const & z);

View File

@ -98,7 +98,7 @@ namespace detail
// -- Explicit basic constructors -- // -- Explicit basic constructors --
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, P>::tquat(ctor) GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tquat<T, P>::tquat(ctor)
{} {}
template <typename T, precision P> template <typename T, precision P>