summaryrefslogtreecommitdiffhomepage
path: root/compat/unroll.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'compat/unroll.hpp')
-rw-r--r--compat/unroll.hpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/compat/unroll.hpp b/compat/unroll.hpp
new file mode 100644
index 00000000..2b74ed1a
--- /dev/null
+++ b/compat/unroll.hpp
@@ -0,0 +1,13 @@
+#pragma once
+
+namespace floormat {
+
+template<uint32_t Max, typename F>
+constexpr CORRADE_ALWAYS_INLINE void unroll(F&& fn)
+{
+ [&]<size_t... Is>(std::index_sequence<Is...>) {
+ (..., fn(std::integral_constant<size_t, Is>{}));
+ }(std::make_index_sequence<Max>());
+}
+
+} // namespace floormat