4 ms·
Because your callee is stupid, and it doesn't know about your extra argument. The pointer you give it needs to look like a normal function pointer in every way:
by saagarjha 7y ago
Because your callee is stupid, and it doesn't know about your extra argument. The pointer you give it needs to look like a normal function pointer in every way: it can't take different parameters, it can't return something else, and it can't move around. Almost all languages with first-class closures do it the way you mention, but the limitation is that you can't use them with code that's not expecting it.
- lultimouomo 7y agoThat makes sense, a C++ templated callee can know that it's calling what is essentially a member function, a C non-templated function can't.