XIEITE_LIFT(), XIEITE_LIFT_LOCAL(), XIEITE_LIFT_ONE(), XIEITE_LIFT_ONE_LOCAL()

Defined in header <xieite/lift.hpp>
(header-only: <xieite/pp/lift.hpp>)


Wraps a function in a lambda object.


Definitions

#lift
#define XIEITE_LIFT(...) /* [](???) XIEITE_ARROW(__VA_ARGS__(???...)) */
Expands to a lambda expression with no capture-default and variadic parameters.

#lift-local
#define XIEITE_LIFT_LOCAL(...) /* [&](???) XIEITE_ARROW(__VA_ARGS__(???...)) */
Expands to a lambda expression with a reference capture-default and variadic parameters.

#lift-one
#define XIEITE_LIFT_ONE(...) /* [](???) XIEITE_ARROW(__VA_ARGS__(???)) */
Expands to a lambda expression with no capture-default and one parameter.

#lift-one-local
#define XIEITE_LIFT_ONE_LOCAL(...) /* [&](???) XIEITE_ARROW(__VA_ARGS__(???)) */
Expands to a lambda expression with a reference capture-default and one parameter.


Example

#include <xieite/fwd.hpp>
#include <xieite/lift.hpp>
import std;

void run(auto&& fn) {
	std::invoke(XIEITE_FWD(fn), "Hello, world!\n");
}

int main() {
	run(XIEITE_LIFT(std::printf));
}
Output:
Hello, world!
[View in Compiler Explorer]