mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-11 16:49:16 +05:00
constexpr test for integral constant
This commit is contained in:
parent
c5b1177151
commit
06ae01b5a7
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user