diff options
Diffstat (limited to 'src/Common/Lambda.hpp')
| -rw-r--r-- | src/Common/Lambda.hpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Common/Lambda.hpp b/src/Common/Lambda.hpp new file mode 100644 index 0000000..8bcfd89 --- /dev/null +++ b/src/Common/Lambda.hpp @@ -0,0 +1,14 @@ +#pragma once + +#define _LAMBDA_ARG1 auto a +#define _LAMBDA_ARG2 auto a, auto b +#define _LAMBDA_ARG3 auto a, auto b, auto c + +#define _LAMBDA_PARAM1 a +#define _LAMBDA_PARAM2 a, b +#define _LAMBDA_PARAM3 a, b, c + +// A macro to create a lambda function around a (usually std) function, +// where the template arguments aren't properly deduced. +// Up to 3 arguments are supported. +#define LAMBDA(f, n) [](_LAMBDA_ARG##n) { return f(_LAMBDA_PARAM##n); } |
