Improve LINE_F code
This commit is contained in:
@@ -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__
|
Reference in New Issue
Block a user