Speeduino
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
static_for< from, to > Struct Template Reference

Generate a fixed number of calls to a given free function at compile time. More...

#include <static_for.hpp>

Static Public Member Functions

template<typename funcType , typename... Args>
static void repeat_n (funcType f, Args...args)
 Unroll, calling a free function.
 

Detailed Description

template<uint8_t from, uint8_t to>
struct static_for< from, to >

Generate a fixed number of calls to a given free function at compile time.

Usage:

static inline void foo(uint8_t index, time_t *currTime, const char *message) {
// Do something
}
char message[] = "Unrolled!";
// Equivalent of
// foo(3, &currTime, message);
// foo(4, &currTime, message);
// foo(5, &currTime, message);
// foo(6, &currTime, message);
static TIntegral readSerialIntegralTimeout(void)
Reads an integral type, timing out if necessary.
Definition comms.cpp:173
static void repeat_n(funcType f, Args...args)
Unroll, calling a free function.
Definition static_for.hpp:55
Template Parameters
fromThe lower bound
toThe upper bound (exclusive)

Member Function Documentation

◆ repeat_n()

template<uint8_t from, uint8_t to>
template<typename funcType , typename... Args>
static void static_for< from, to >::repeat_n ( funcType  f,
Args...  args 
)
inlinestatic

Unroll, calling a free function.

Attention
The free function must have a uint8_t first parameter. This is the "loop" index, which will be injected automatically
Template Parameters
funcTypeFunction signature (should be automatically deduced)
ArgsFunction argument pack (should be automatically deduced)
Parameters
fThe function to call
argsFunction arguments in addition to the "loop" index
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this struct was generated from the following file: