logoalt Hacker News

mandarax806/15/20251 replyview on HN

What he shows here is 75% of c++26's std::function_ref. It's mainly missing variadic arguments and doesn't support all types of function objects.

https://github.com/TartanLlama/function_ref/blob/master/incl...


Replies

kjksf06/15/2025

I can honestly say that I couldn't write that thing in 100 years.

I can't even read it.

That's the fundamental problem with C++: I've understood pretty much all Go code I ever looked at.

The code like the above is so obtuse that 0.001% of C++ programmers is capable of writing it and 0.01% is capable of understanding it.

Sure, I can treat it as magic but I would rather not.

show 4 replies