Remove type_trait.inl infavor of using enums for constants.

This commit is contained in:
ZXShady 2025-03-07 20:32:39 +00:00
parent 302ea03860
commit 56b40afefd
2 changed files with 34 additions and 86 deletions

View file

@ -31,53 +31,62 @@ namespace glm
template<typename T>
struct type
{
static bool const is_vec = false;
static bool const is_mat = false;
static bool const is_quat = false;
static length_t const components = 0;
static length_t const cols = 0;
static length_t const rows = 0;
enum {
is_vec = false,
is_mat = false,
is_quat = false,
components = 0,
cols = 0,
rows = 0
};
};
template<length_t L, typename T, qualifier Q>
struct type<vec<L, T, Q> >
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
static length_t const components = L;
enum {
is_vec = true,
is_mat = false,
is_quat = false,
components = L
};
};
template<length_t C, length_t R, typename T, qualifier Q>
struct type<mat<C, R, T, Q> >
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
static length_t const components = C;
static length_t const cols = C;
static length_t const rows = R;
enum {
is_vec = false,
is_mat = true,
is_quat = false,
components = C,
cols = C,
rows = R
};
};
template<typename T, qualifier Q>
struct type<qua<T, Q> >
{
static bool const is_vec = false;
static bool const is_mat = false;
static bool const is_quat = true;
static length_t const components = 4;
enum {
is_vec = false,
is_mat = false,
is_quat = true,
components = 4
};
};
template<typename T, qualifier Q>
struct type<tdualquat<T, Q> >
{
static bool const is_vec = false;
static bool const is_mat = false;
static bool const is_quat = true;
static length_t const components = 8;
enum {
is_vec = false,
is_mat = false,
is_quat = true,
components = 8
};
};
/// @}
}//namespace glm
#include "type_trait.inl"

View file

@ -1,61 +0,0 @@
/// @ref gtx_type_trait
namespace glm
{
template<typename T>
bool const type<T>::is_vec;
template<typename T>
bool const type<T>::is_mat;
template<typename T>
bool const type<T>::is_quat;
template<typename T>
length_t const type<T>::components;
template<typename T>
length_t const type<T>::cols;
template<typename T>
length_t const type<T>::rows;
// vec
template<length_t L, typename T, qualifier Q>
bool const type<vec<L, T, Q> >::is_vec;
template<length_t L, typename T, qualifier Q>
bool const type<vec<L, T, Q> >::is_mat;
template<length_t L, typename T, qualifier Q>
bool const type<vec<L, T, Q> >::is_quat;
template<length_t L, typename T, qualifier Q>
length_t const type<vec<L, T, Q> >::components;
// mat
template<length_t C, length_t R, typename T, qualifier Q>
bool const type<mat<C, R, T, Q> >::is_vec;
template<length_t C, length_t R, typename T, qualifier Q>
bool const type<mat<C, R, T, Q> >::is_mat;
template<length_t C, length_t R, typename T, qualifier Q>
bool const type<mat<C, R, T, Q> >::is_quat;
template<length_t C, length_t R, typename T, qualifier Q>
length_t const type<mat<C, R, T, Q> >::components;
template<length_t C, length_t R, typename T, qualifier Q>
length_t const type<mat<C, R, T, Q> >::cols;
template<length_t C, length_t R, typename T, qualifier Q>
length_t const type<mat<C, R, T, Q> >::rows;
// tquat
template<typename T, qualifier Q>
bool const type<qua<T, Q> >::is_vec;
template<typename T, qualifier Q>
bool const type<qua<T, Q> >::is_mat;
template<typename T, qualifier Q>
bool const type<qua<T, Q> >::is_quat;
template<typename T, qualifier Q>
length_t const type<qua<T, Q> >::components;
// tdualquat
template<typename T, qualifier Q>
bool const type<tdualquat<T, Q> >::is_vec;
template<typename T, qualifier Q>
bool const type<tdualquat<T, Q> >::is_mat;
template<typename T, qualifier Q>
bool const type<tdualquat<T, Q> >::is_quat;
template<typename T, qualifier Q>
length_t const type<tdualquat<T, Q> >::components;
}//namespace glm