I have that code that recognizes which GL type you need to use based on C++ types. I want to make a _t version of it (like std::decay_t or std::enable_if_t) but expose int constant value
template <typename T, typename = void> struct GLType {};
template <typename T>
struct GLType<T, std::enable_if_t<std::is_same_v<std::remove_pointer_t<std::decay_t<T>>, float>>> {
const static constexpr int type = GL_FLOAT;
};
template <typename T>
struct GLType<T, std::enable_if_t<std::is_same_v<std::remove_pointer_t<std::decay_t<T>>, double>>> {
const static constexpr int type = GL_DOUBLE;
};
My first try was
template <typename T>
using GLType_t = GLType<T>::type;
but that doesn't work. Is it even possible to return value instead of type in the same way?
In the end, I want something like
int a = GLType_t<float>;
// instead of
int a = GLType<float>::type; // which works fine btw