SFINAE.h 692 B

123456789101112131415161718192021
  1. #pragma once
  2. #include <glm/detail/qualifier.hpp>
  3. #include <glm/detail/type_vec1.hpp>
  4. namespace WallpaperEngine::Data::Utils::SFINAE {
  5. // sfinae to detect the type for template specialization
  6. template <typename T> struct is_glm_vec : std::false_type { };
  7. template <glm::length_t L, typename S, glm::qualifier Q> struct is_glm_vec<glm::vec<L, S, Q>> : std::true_type { };
  8. // traits used to guess the type of the vector and it's length
  9. template <typename T> struct GlmVecTraits;
  10. template <glm::length_t L, typename T, glm::qualifier Q> struct GlmVecTraits<glm::vec<L, T, Q>> {
  11. static constexpr int length = L;
  12. using type = T;
  13. static constexpr glm::qualifier qualifier = Q;
  14. };
  15. }