constexpr test for integral constant

This commit is contained in:
Joachim Schoeberl 2023-08-18 09:40:29 +02:00
parent c5b1177151
commit 06ae01b5a7

View File

@ -253,6 +253,27 @@ namespace ngcore
template <int N> using IC = std::integral_constant<int,N>; // needed for Iterate
namespace detail {
template <typename T, typename Enable = int>
struct IsIC_trait {
static constexpr auto check() { return false; }
};
template <typename T>
struct IsIC_trait<T, std::enable_if_t<std::is_same_v<T, IC<T::value>> == true, int> > {
static constexpr auto check() { return true; }
};
}
template <typename T>
constexpr bool is_IC() {
return detail::IsIC_trait<T>::check();
}
template <int NUM, typename FUNC>
NETGEN_INLINE void Iterate (FUNC f)