1// To some free-function
2struct func_wrap
3{
4 using f_t = func_wrap(*)();
5 f_t func;
6 f_t operator()() const noexcept { return func; }
7 operator f_t() const noexcept { return func; }
8};
9
10using func_t = func_wrap(*)();
11
12// Function to wrap
13func_wrap foo() { return func_wrap{foo}; }
14
15func_t bar() { return foo(); }
16func_t buz() { return foo()(); }
17
18// Some functor
19struct function
20{
21 function operator()() const noexcept
22 {
23 return function();
24 }
25};
26
27function foo(int) { return function(); }
28function bar(int) { return function()(); }
29function buz(int) { return function()()(); }
30