Programming requires making fine-grained implementation decisions.
There are numerous differences between my Func0 and Func1<T> and std::function<>.
Runtime size, runtime performance, compilation speed, understandability of the code, size of the source code, size of the generated code, ergonomics of use.
My solution wins on everything except ergonomics of use.
LLVM has a small vector class.
When asked for comment, pjmlp said: "Another example of NIH, better served by using the standard library".
I think context is important. In a large corporate context, NIH kills you because everything you implement needs to be documented, debugged, and understood by 10s or 100s of other people. In a small or one-man project, a lot of the NIH downsides go away and it makes (some) sense to reinvent the wheel if there are performance or simplicity benefits to be had. Consider Roller Coaster Tycoon as an example of the latter - where the author wrote everything in asm out of personal preference and for performance reason instead of using C and its libraries.
I'm surprised by how many people on HN are yelling at the author to code as if he's working at a company like Adobe, when objectively Adobe's PDF reader is dogshit (especially performance wise) for most people and is probably built on best practices like using standard libraries.
There are numerous differences between my Func0 and Func1<T> and std::function<>.
Runtime size, runtime performance, compilation speed, understandability of the code, size of the source code, size of the generated code, ergonomics of use.
My solution wins on everything except ergonomics of use.
LLVM has a small vector class.
When asked for comment, pjmlp said: "Another example of NIH, better served by using the standard library".