logoalt Hacker News

leni536yesterday at 8:16 PM1 replyview on HN

I wouldn't. This is very specialized to the type of the elements.


Replies

VorpalWayyesterday at 9:51 PM

Some languages, such as C++, allow for specialisation via templates and compile time evabulation (constexpr). It would be possible to detect when the size of the data type matches one of the integer types, is a POD, is comparable via memcmp, etc to use SIMD optimised algorithms.

It is looking like C++ 26 will get compile time reflection, which would make things like this even more feasible.