Stats
274,247
reputation
203k
reached
102
answers
1
question
Loading…
Communities
About
template<class R, class...Args>
auto Y = [](auto f) {
auto action = [](auto f, auto&& action)->std::function<R(Args...)> {
return [f, action](Args&&...args)mutable ->R{
return f( action(std::ref(f), action), std::forward<Args>(args)... );
};
};
return action(f, action);
};
Some fun C++ stuff I've done round here:
- A: Convert a run-time value or type to a compile-time value, also works with lists of types.
- A: Named operators, does what it says on the tin
- A: can_apply, a useful trick that helps make traits like "can serialize" or "can convert to string".
- A: task, a move-only implementation of
std::function
. - Q: Function curry, that does partial binds and the like.
- A: Me playing around with hana-like metaprogramming, together with the idea that template work best if everything (including templates) is a type. Here is some evil operator abuse, where I manipulate types with
+
. - A:
std::function
that returns vectors of its own type.
Here is a neat question I didn't ask:
the answer seems to be "actually, nope, but nobody noticed".
An amusing link:
which will show your reputation history on stack overflow, if you like that kind of thing.
ey eir em
Badges
View all badges
3
-
Populist
× 2Jan 21, 2016 -
Great AnswerJan 20, 2016
40
-
discussionMay 2, 2018
-
GeneralistJun 15, 2016
-
PunditSep 6, 2014
Top tags
View all tags
1,107
Score
84
Posts
82
Posts %
228
Score
12
Posts
12
Posts %
184
Score
12
Posts
12
Posts %
175
Score
8
Posts
8
Posts %
108
Score
10
Posts
10
Posts %
100
Score
8
Posts
8
Posts %