blob: 8bcfd898f67b4dbef86588c845e66a4fa7369be9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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); }
|