3 ms·
I think it probably would in this case. They appear to be substituting just a comparison function. They could instead take a generic type argument that had the
by kevincox 5y ago
I think it probably would in this case. They appear to be substituting just a comparison function. They could instead take a generic type argument that had the desired functions defined. Then you would just need to write the top level wrappers with the different names.
In fact they could probably have done this with a traditional Go interface if they weren't worried about missed optimizations.
- deleted 5y ago[deleted]
- yencabulator 5y agoI fear the generic version would miss on those same optimizations, and that is the real reason it's written like it is. Remember, Go generics use gcshape stenciling, not C++ style templates.