tools:cplusplus
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tools:cplusplus [2021/05/19 15:14] – [Templates] ursgraf | tools:cplusplus [2021/07/08 19:31] (current) – [Lambda Functions] ursgraf | ||
---|---|---|---|
Line 52: | Line 52: | ||
===== Lambda Functions ===== | ===== Lambda Functions ===== | ||
A lambda is an anonymous function which can be passed as a parameter. While using EEROS lambda functions are useful for several cases. | A lambda is an anonymous function which can be passed as a parameter. While using EEROS lambda functions are useful for several cases. | ||
- | * Safety system: | + | * Safety system: |
- | * Function used by periodic: | + | * Function used by periodic: |
- | * Generic block: | + | * Generic block: |
+ | |||
+ | A lambda function must be defined as follows | ||
+ | <code cpp> | ||
+ | [captures] (params) {body} | ||
+ | </ | ||
+ | Captures are variables which are defined in the scope where the lambda function is defined and which can be made available to the lambda function either by value or by reference. Params are parameters which can be passed into the function like regular parameters. The body contains the code which is executed by the function. | ||
+ | |||
tools/cplusplus.1621430096.txt.gz · Last modified: 2021/05/19 15:14 by ursgraf