Improve LINE_F code

This commit is contained in:
2023-05-27 22:21:02 +02:00
parent f67361c62b
commit 3d0a5b81c2
5 changed files with 108 additions and 47 deletions

View File

@@ -9,6 +9,50 @@ namespace JabyEngine {
struct enable_if<true, T> {
typedef T type;
};
// #############################################
template<class T, class U>
struct is_same {
static constexpr bool value = false;
};
template<class T>
struct is_same<T, T> {
static constexpr bool value = true;
};
// #############################################
template<bool B, class T, class F>
struct conditional {
using type = T;
};
template<class T, class F>
struct conditional<false, T, F> {
using type = F;
};
// #############################################
template<class...>
struct conjunction {
static constexpr bool value = true;
};
template<class B1>
struct conjunction<B1> : B1 {
};
template<class B1, class... Bn>
struct conjunction<B1, Bn...> : conditional<bool(B1::value), conjunction<Bn...>, B1>::type {
};
// #############################################
template<typename T, typename... Ts>
using variadic_force_same = enable_if<conjunction<is_same<T, Ts>...>::value>::type;
}
#endif //! __JABYENGINE_TYPE_TRAITS_HPP__