File constexpr_for.h
File List > code_source > templat > include > TempLat > util > constexpr_for.h
Go to the documentation of this file
#ifndef TEMPLAT_UTIL_CONSTEXPR_FOR_H
#define TEMPLAT_UTIL_CONSTEXPR_FOR_H
/* This file is part of TempLat, available at https://cosmolattice.github.io/templat .
Copyright 2021-2026 The TempLat authors, see AUTHORS.md.
Released under the MIT license, see LICENSE.md. */
// File info: Main contributor(s): Franz R. Sattler, Year: 2025
#include <type_traits>
#include "TempLat/util/rangeiteration/tag.h"
#include "TempLat/parallel/device.h"
namespace TempLat
{
template <auto Start, auto End, class F> DEVICE_INLINE_FUNCTION constexpr void constexpr_for(F &&f)
{
if constexpr (Start < End) {
f(Tag<Start>{});
constexpr_for<Start + 1, End>(f);
}
}
} // namespace TempLat
#endif