XTE _ LIFT ()
Defined in header <xte/preproc/lift.hpp> Wraps something callable in a lambda object. Automatically includes a
noexcept specifier and a requires clause.Definitions
#liftWraps a callable which accepts any number of arguments.#define XTE_LIFT (... )\ [](auto&&... /* args */ )static \ XTE_ARROW (__VA_ARGS__ (XTE_FWD (/* args */ )...))
#unary
Wraps a callable which only accepts one argument (e.g.#define XTE_LIFT_UNARY (... )\ [](auto&& /* arg */ )static \ XTE_ARROW (__VA_ARGS__ (XTE_FWD (/* arg */ )))
static_cast ).#local
Wraps a callable which depends on local variables.#define XTE_LIFT_LOCAL (... )\ [& ](auto&&... /* args */ )\ XTE_ARROW (__VA_ARGS__ (XTE_FWD (/* args */ )...))
#infix
Wraps a binary operator (e.g.#define XTE_LIFT_INFIX (... )\ [](auto&& /* lhs */ ,auto&& /* rhs */ )static \ XTE_ARROW (XTE_FWD (/* lhs */ )__VA_ARGS__ (XTE_FWD (/* rhs */ )))
+).#member-func
Wraps a member function, prefixed with#define XTE_LIFT_MEMBER (... )\ [](auto&& /* obj */ ,auto&&... /* args */ )static \ XTE_ARROW (XTE_FWD (/* obj */ )__VA_ARGS__ (XTE_FWD (/* args */ )...))
. or ->.#member-var
Wraps a member variable, prefixed with#define XTE_LIFT_VAR (... )\ [](auto&& /* obj */ )static noexcept \ {return XTE_FWD (/* obj */ )__VA_ARGS__ ; }
. or ->.Example
Output:template <typename T >void templated (T _arg ) {std ::println ("{}" ,_arg ); }void call (auto func ) {func (5 ); }call (XTE_LIFT (templated ));
[View in Compiler Explorer]5