Blender V5.3
BLI_unroll.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2024 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include <cstdlib>
12#include <utility>
13
14namespace blender {
15
16template<class Fn, size_t... I>
17constexpr void unroll_impl(Fn fn, std::index_sequence<I...> /*indices*/)
18{
19 (fn(I), ...);
20}
21
27template<int N, class Fn> constexpr void unroll(Fn fn)
28{
29 unroll_impl(fn, std::make_index_sequence<N>());
30}
31
32} // namespace blender
BMesh Iterators.
constexpr void unroll_impl(Fn fn, std::index_sequence< I... >)
Definition BLI_unroll.hh:17
constexpr void unroll(Fn fn)
Definition BLI_unroll.hh:27
#define I