#pragma once #include typedef int (*compar_t)(const void*, const void*); void c_quicksort(void* base, usize nmemb, usize size, compar_t compar); template void sort(T* base, usize nmemb, int (*compar)(const T*, const T*)) { return c_quicksort(base, nmemb, sizeof(T), (compar_t)compar); } template void sort(T* base, usize nmemb, compar_t compar) { return c_quicksort(base, nmemb, sizeof(T), compar); } template void sort(T* begin, T* end, int (*compar)(const T*, const T*)) { return c_quicksort(begin, end - begin, sizeof(T), (compar_t)compar); } template void sort(T* begin, T* end, compar_t compar) { return c_quicksort(begin, end - begin, sizeof(T), compar); }