std::function implementation
Your code has no chance of working, because the only non-static data member of your function&lt;void(void)&gt; is a single pointer of type void (*)(void). There's no room to store any other kind of functor.

In other words, you've implemented the concept of "function pointer wrapped in a struct", but you haven't implemented anything like std::function yet.