Complile-time for loop. More...
Go to the source code of this file.
Namespaces | |
| namespace | bbm |
Concepts | |
| concept | bbm::has_constfor_lambda |
| Concept to check if a lambda function meets the required signature. | |
Macros | |
| #define | CONSTFOR(IDX, NUMITR, ...) bbm::constfor<NUMITR>( [&]<size_t IDX>() { __VA_ARGS__; } ); |
| HELPER MACRO. | |
Functions | |
| template<typename F , size_t... IDX> requires (sizeof...(IDX) == 0 || has_constfor_lambda<F>) | |
| constexpr void | constfor (F &&f, std::index_sequence< IDX... >) |
| constfor given an index sequence of indexes. | |
| template<size_t NumItr, typename F > requires (NumItr == 0 || has_constfor_lambda<F>) | |
| constexpr void | constfor (F &&f) |
| constfor given the number of iterations | |
Complile-time for loop.
Expects the body to be passed as a templated lambda that takes a size_t literal as template parameter, and no arguments.
Example:
Prints values from 0 to 3.
A helper macro simplifies the call:
| #define CONSTFOR | ( | IDX, | |
| NUMITR, | |||
| ... | |||
| ) | bbm::constfor<NUMITR>( [&]<size_t IDX>() { __VA_ARGS__; } ); |
HELPER MACRO.