#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); }