Simplify GLM_FORCE_EXPLICIT_CTOR declarations

- Instead of wrapping the declarations, use a macro for the keyword "explicit"
This commit is contained in:
Jesse Talavera-Greenberg 2015-07-20 20:18:24 -04:00
parent c2078afc12
commit 9cc7dc1763
15 changed files with 39 additions and 118 deletions

View File

@ -98,13 +98,8 @@ namespace glm
////////////////////////////////////// //////////////////////////////////////
// Matrix conversions // Matrix conversions
# ifdef GLM_FORCE_EXPLICIT_CTOR
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL explicit tmat2x2(tmat2x2<U, Q> const & m); GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tmat2x2(tmat2x2<U, Q> const & m);
# else
template <typename U, precision Q>
GLM_FUNC_DECL tmat2x2(tmat2x2<U, Q> const & m);
# endif
GLM_FUNC_DECL explicit tmat2x2(tmat3x3<T, P> const & x); GLM_FUNC_DECL explicit tmat2x2(tmat3x3<T, P> const & x);
GLM_FUNC_DECL explicit tmat2x2(tmat4x4<T, P> const & x); GLM_FUNC_DECL explicit tmat2x2(tmat4x4<T, P> const & x);

View File

@ -94,13 +94,8 @@ namespace glm
////////////////////////////////////// //////////////////////////////////////
// Matrix conversion // Matrix conversion
# ifdef GLM_FORCE_EXPLICIT_CTOR
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL explicit tmat2x3(tmat2x3<U, Q> const & m); GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tmat2x3(tmat2x3<U, Q> const & m);
# else
template <typename U, precision Q>
GLM_FUNC_DECL tmat2x3(tmat2x3<U, Q> const & m);
# endif
GLM_FUNC_DECL explicit tmat2x3(tmat2x2<T, P> const & x); GLM_FUNC_DECL explicit tmat2x3(tmat2x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat2x3(tmat3x3<T, P> const & x); GLM_FUNC_DECL explicit tmat2x3(tmat3x3<T, P> const & x);

View File

@ -95,13 +95,8 @@ namespace glm
////////////////////////////////////// //////////////////////////////////////
// Matrix conversions // Matrix conversions
# ifdef GLM_FORCE_EXPLICIT_CTOR
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL explicit tmat2x4(tmat2x4<U, Q> const & m); GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tmat2x4(tmat2x4<U, Q> const & m);
# else
template <typename U, precision Q>
GLM_FUNC_DECL tmat2x4(tmat2x4<U, Q> const & m);
# endif
GLM_FUNC_DECL explicit tmat2x4(tmat2x2<T, P> const & x); GLM_FUNC_DECL explicit tmat2x4(tmat2x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat2x4(tmat3x3<T, P> const & x); GLM_FUNC_DECL explicit tmat2x4(tmat3x3<T, P> const & x);

View File

@ -101,13 +101,8 @@ namespace glm
////////////////////////////////////// //////////////////////////////////////
// Matrix conversions // Matrix conversions
# ifdef GLM_FORCE_EXPLICIT_CTOR
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL explicit tmat3x2(tmat3x2<U, Q> const & m); GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tmat3x2(tmat3x2<U, Q> const & m);
# else
template <typename U, precision Q>
GLM_FUNC_DECL tmat3x2(tmat3x2<U, Q> const & m);
# endif
GLM_FUNC_DECL explicit tmat3x2(tmat2x2<T, P> const & x); GLM_FUNC_DECL explicit tmat3x2(tmat2x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat3x2(tmat3x3<T, P> const & x); GLM_FUNC_DECL explicit tmat3x2(tmat3x3<T, P> const & x);

View File

@ -105,13 +105,8 @@ namespace glm
////////////////////////////////////// //////////////////////////////////////
// Matrix conversions // Matrix conversions
# ifdef GLM_FORCE_EXPLICIT_CTOR
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL explicit tmat3x3(tmat3x3<U, Q> const & m); GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tmat3x3(tmat3x3<U, Q> const & m);
# else
template <typename U, precision Q>
GLM_FUNC_DECL tmat3x3(tmat3x3<U, Q> const & m);
# endif
GLM_FUNC_DECL explicit tmat3x3(tmat2x2<T, P> const & x); GLM_FUNC_DECL explicit tmat3x3(tmat2x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat3x3(tmat4x4<T, P> const & x); GLM_FUNC_DECL explicit tmat3x3(tmat4x4<T, P> const & x);

View File

@ -100,13 +100,8 @@ namespace glm
////////////////////////////////////// //////////////////////////////////////
// Matrix conversion // Matrix conversion
# ifdef GLM_FORCE_EXPLICIT_CTOR
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL explicit tmat3x4(tmat3x4<U, Q> const & m); GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tmat3x4(tmat3x4<U, Q> const & m);
# else
template <typename U, precision Q>
GLM_FUNC_DECL tmat3x4(tmat3x4<U, Q> const & m);
# endif
GLM_FUNC_DECL explicit tmat3x4(tmat2x2<T, P> const & x); GLM_FUNC_DECL explicit tmat3x4(tmat2x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat3x4(tmat3x3<T, P> const & x); GLM_FUNC_DECL explicit tmat3x4(tmat3x3<T, P> const & x);

View File

@ -106,13 +106,8 @@ namespace glm
////////////////////////////////////// //////////////////////////////////////
// Matrix conversions // Matrix conversions
# ifdef GLM_FORCE_EXPLICIT_CTOR
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL explicit tmat4x2(tmat4x2<U, Q> const & m); GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tmat4x2(tmat4x2<U, Q> const & m);
# else
template <typename U, precision Q>
GLM_FUNC_DECL tmat4x2(tmat4x2<U, Q> const & m);
# endif
GLM_FUNC_DECL explicit tmat4x2(tmat2x2<T, P> const & x); GLM_FUNC_DECL explicit tmat4x2(tmat2x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat4x2(tmat3x3<T, P> const & x); GLM_FUNC_DECL explicit tmat4x2(tmat3x3<T, P> const & x);

View File

@ -105,13 +105,8 @@ namespace glm
////////////////////////////////////// //////////////////////////////////////
// Matrix conversions // Matrix conversions
# ifdef GLM_FORCE_EXPLICIT_CTOR
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL explicit tmat4x3(tmat4x3<U, Q> const & m); GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tmat4x3(tmat4x3<U, Q> const & m);
# else
template <typename U, precision Q>
GLM_FUNC_DECL tmat4x3(tmat4x3<U, Q> const & m);
# endif
GLM_FUNC_DECL explicit tmat4x3(tmat2x2<T, P> const & x); GLM_FUNC_DECL explicit tmat4x3(tmat2x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat4x3(tmat3x3<T, P> const & x); GLM_FUNC_DECL explicit tmat4x3(tmat3x3<T, P> const & x);

View File

@ -110,13 +110,8 @@ namespace glm
////////////////////////////////////// //////////////////////////////////////
// Matrix conversions // Matrix conversions
# ifdef GLM_FORCE_EXPLICIT_CTOR
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL explicit tmat4x4(tmat4x4<U, Q> const & m); GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tmat4x4(tmat4x4<U, Q> const & m);
# else
template <typename U, precision Q>
GLM_FUNC_DECL tmat4x4(tmat4x4<U, Q> const & m);
# endif
GLM_FUNC_DECL explicit tmat4x4(tmat2x2<T, P> const & x); GLM_FUNC_DECL explicit tmat4x4(tmat2x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat4x4(tmat3x3<T, P> const & x); GLM_FUNC_DECL explicit tmat4x4(tmat3x3<T, P> const & x);

View File

@ -136,15 +136,9 @@ namespace glm
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL explicit tvec1(tvec4<U, Q> const & v); GLM_FUNC_DECL explicit tvec1(tvec4<U, Q> const & v);
# ifdef GLM_FORCE_EXPLICIT_CTOR
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL explicit tvec1(tvec1<U, Q> const & v); GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tvec1(tvec1<U, Q> const & v);
# else
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
GLM_FUNC_DECL tvec1(tvec1<U, Q> const & v);
# endif
////////////////////////////////////// //////////////////////////////////////
// Swizzle constructors // Swizzle constructors

View File

@ -144,15 +144,9 @@ namespace glm
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL explicit tvec2(tvec4<U, Q> const & v); GLM_FUNC_DECL explicit tvec2(tvec4<U, Q> const & v);
# ifdef GLM_FORCE_EXPLICIT_CTOR
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL explicit tvec2(tvec2<U, Q> const & v); GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tvec2(tvec2<U, Q> const & v);
# else
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
GLM_FUNC_DECL tvec2(tvec2<U, Q> const & v);
# endif
////////////////////////////////////// //////////////////////////////////////
// Swizzle constructors // Swizzle constructors

View File

@ -154,15 +154,9 @@ namespace glm
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL explicit tvec3(tvec4<U, Q> const & v); GLM_FUNC_DECL explicit tvec3(tvec4<U, Q> const & v);
# ifdef GLM_FORCE_EXPLICIT_CTOR
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL explicit tvec3(tvec3<U, Q> const & v); GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tvec3(tvec3<U, Q> const & v);
# else
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
GLM_FUNC_DECL tvec3(tvec3<U, Q> const & v);
# endif
////////////////////////////////////// //////////////////////////////////////
// Swizzle constructors // Swizzle constructors

View File

@ -230,15 +230,9 @@ namespace detail
template <typename A, typename B, precision Q> template <typename A, typename B, precision Q>
GLM_FUNC_DECL explicit tvec4(tvec2<A, Q> const & a, tvec2<B, Q> const & b); GLM_FUNC_DECL explicit tvec4(tvec2<A, Q> const & a, tvec2<B, Q> const & b);
# ifdef GLM_FORCE_EXPLICIT_CTOR
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL explicit tvec4(tvec4<U, Q> const & v); GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tvec4(tvec4<U, Q> const & v);
# else
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
GLM_FUNC_DECL tvec4(tvec4<U, Q> const & v);
# endif
////////////////////////////////////// //////////////////////////////////////
// Swizzle constructors // Swizzle constructors

View File

@ -108,15 +108,10 @@ namespace glm
GLM_FUNC_DECL tquat(T const & w, T const & x, T const & y, T const & z); GLM_FUNC_DECL tquat(T const & w, T const & x, T const & y, T const & z);
////////////////////////////////////// //////////////////////////////////////
// Convertions // Conversions
# ifdef GLM_FORCE_EXPLICIT_CTOR
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL explicit tquat(tquat<U, Q> const & q); GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tquat(tquat<U, Q> const & q);
# else
template <typename U, precision Q>
GLM_FUNC_DECL tquat(tquat<U, Q> const & q);
# endif
// explicit conversion operators // explicit conversion operators
# if GLM_HAS_EXPLICIT_CONVERSION_OPERATORS # if GLM_HAS_EXPLICIT_CONVERSION_OPERATORS

View File

@ -110,13 +110,8 @@ namespace glm
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// tdualquat conversions // tdualquat conversions
# ifdef GLM_FORCE_EXPLICIT_CTOR
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL explicit tdualquat(tdualquat<U, Q> const & q); GLM_FUNC_DECL GLM_EXPLICIT_CTOR_MAYBE tdualquat(tdualquat<U, Q> const & q);
# else
template <typename U, precision Q>
GLM_FUNC_DECL tdualquat(tdualquat<U, Q> const & q);
# endif
GLM_FUNC_DECL explicit tdualquat(tmat2x4<T, P> const & holder_mat); GLM_FUNC_DECL explicit tdualquat(tmat2x4<T, P> const & holder_mat);
GLM_FUNC_DECL explicit tdualquat(tmat3x4<T, P> const & aug_mat); GLM_FUNC_DECL explicit tdualquat(tmat3x4<T, P> const & aug_mat);