Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
LambdaPuller.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <AH/STL/utility> // std::forward
4#include <Settings/NamespaceSettings.hpp>
5
7
12template <class Lambda>
14 public:
15 LambdaPuller_(Lambda &&lambda) : lambda(std::forward<Lambda>(lambda)) {}
16
17 template <class T>
18 bool pull(T &packet) {
19 return lambda(packet);
20 }
21
22 private:
23 Lambda lambda;
24};
25
26template <class Lambda>
28 return std::forward<Lambda>(lambda);
29}
30
LambdaPuller_< Lambda > LambdaPuller(Lambda &&lambda)
#define END_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Helper to turn a lambda function into a puller.
bool pull(T &packet)
LambdaPuller_(Lambda &&lambda)