Given a range of values and a range of categories, separates values
by category. This function also guarantees that the order within each
category will be maintained.
Note: While the general convention of this library is to try to avoid
heap allocations whenever possible so that multithreaded code scales well and
false pointers aren't an issue, this function allocates like crazy
because there's basically no other way to implement it. Don't use it in
performance-critical multithreaded code.
ElementType!(V)[][ElementType!(C)]byCategory(V values, C categories)
Given a range of values and a range of categories, separates values by category. This function also guarantees that the order within each category will be maintained.
Note: While the general convention of this library is to try to avoid heap allocations whenever possible so that multithreaded code scales well and false pointers aren't an issue, this function allocates like crazy because there's basically no other way to implement it. Don't use it in performance-critical multithreaded code.