mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
move Iterate<D>and Switch<D> to netgen utils
This commit is contained in:
parent
3085fac973
commit
0ad5973101
@ -168,6 +168,28 @@ namespace ngcore
|
|||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template <int N> using IC = std::integral_constant<int,N>; // needed for Iterate
|
||||||
|
|
||||||
|
template <int NUM, typename FUNC>
|
||||||
|
NETGEN_INLINE void Iterate (FUNC f)
|
||||||
|
{
|
||||||
|
if constexpr (NUM > 1) Iterate<NUM-1> (f);
|
||||||
|
if constexpr (NUM >= 1) f(IC<NUM-1>());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <int NUM, typename FUNC>
|
||||||
|
NETGEN_INLINE void Switch (size_t nr, FUNC f)
|
||||||
|
{
|
||||||
|
if (NUM-1 == nr) f(IC<NUM-1>());
|
||||||
|
if constexpr (NUM > 1) Switch<NUM-1> (nr, f);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
Loading…
Reference in New Issue
Block a user