Skip to content

Commit a929bf7

Browse files
authored
Make LIFT_FUNCTION more modular
Per the discussion at https://twitter.com/incomputable/status/1623722860610039809
1 parent 42293d6 commit a929bf7

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

include/lift.hpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@
1717
#include <utility>
1818
#include <tuple>
1919

20-
#define LIFT_THRICE(...) \
21-
noexcept(noexcept(__VA_ARGS__)) \
22-
-> decltype(__VA_ARGS__) \
23-
{ \
24-
return __VA_ARGS__; \
25-
}
26-
27-
#define LIFT_FWD(x) std::forward<decltype(x)>(x)
20+
#define LIFT_FUNCTION(f) \
21+
LIFT_ba7b8453f262e429575e23dcb2192b33( \
22+
a_ba7b8453f262e429575e23dcb2192b33, \
23+
(f)(::std::forward<decltype(a_ba7b8453f262e429575e23dcb2192b33)>( \
24+
a_ba7b8453f262e429575e23dcb2192b33)...))
25+
26+
#define LIFT_ba7b8453f262e429575e23dcb2192b33(a, f_of_a) \
27+
[&](auto&&... a) noexcept(noexcept(f_of_a)) -> decltype(f_of_a) { \
28+
return f_of_a; \
29+
}
2830

29-
#define LIFT_FUNCTION(lift_func) [](auto&& ... p) LIFT_THRICE(lift_func(LIFT_FWD(p)...))
3031
#ifndef LIFT
3132
#define LIFT LIFT_FUNCTION
3233
#endif

0 commit comments

Comments
 (0)