Using lambdas as callback functions Using the Ticker library for the ESP32, how can I use a lambda as an argument to the attach method?
tickerSystemManager.attach(1000, [&amp;](){
  systemManager-&gt;sync();
});

Attempting to use the above, I get the following error:
Matrx.cpp:11:4: error: no matching function for call to 'Ticker::attach(int, Matrx::setup()::&lt;lambda()&gt;)'
...
Ticker.h:40:8: note: candidate: void Ticker::attach(float, Ticker::callback_t)

How can I capp a lambda into this method?
As @timemage explains in a comment, you cannot pass a capturing lambda
to a function that expects a plain pointer to function. There is,
however, a way out of this: the Ticker class provides an overload of
the attach() method that allows you to provide a parameter of any type
to tour callback:
template&lt;typename TArg&gt;
void attach(float seconds, void (*callback)(TArg), TArg arg)

You can use this version of attach() and provide it both

a non-capturing lambda that gets a pointer to systemManager
that pointer as a third argument.

Edit: I did a few tests, and it seems my compiler cannot properly
perform template argument deduction in this case, but the approach works
if you explicitly specialize the template. Namely:
tickerSystemManager.attach&lt;typeof systemManager&gt;(
    1000,
    [](typeof systemManager p){ p-&gt;sync(); },
    systemManager);