diff --git a/libsrc/core/utils.hpp b/libsrc/core/utils.hpp index d072be47..ac14f883 100644 --- a/libsrc/core/utils.hpp +++ b/libsrc/core/utils.hpp @@ -168,6 +168,28 @@ namespace ngcore return current; } + + + + template using IC = std::integral_constant; // needed for Iterate + + template + NETGEN_INLINE void Iterate (FUNC f) + { + if constexpr (NUM > 1) Iterate (f); + if constexpr (NUM >= 1) f(IC()); + } + + + template + NETGEN_INLINE void Switch (size_t nr, FUNC f) + { + if (NUM-1 == nr) f(IC()); + if constexpr (NUM > 1) Switch (nr, f); + } + + + namespace detail { template