[algs] Simplify hb_qsort: single template, inline all callers

Reduce to one templated hb_qsort, one templated qsort() on
hb_array_t/hb_vector_t, plus the no-arg qsort() that casts
Type::cmp to resolve ambiguity.

Convert all external call sites to lambdas so comparators
inline everywhere.  Remove the void*-arg overload and the
plain function-pointer overload.

225 tests pass, 0 failures.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Behdad EsfahbodandClaude Opus 4.6 committed 2026-03-27 12:50:30 -06:00
1 parent 05762b2fac
commit df433afe6c
6 files changed
+11 -46

No files matched your search

+1 -3
View File
@@ -705,13 +705,11 @@ struct hb_vector_t
/* Sorting API. */
void qsort (int (*cmp)(const void*, const void*))
{ as_array ().qsort (cmp); }
template <typename Compar>
void qsort (Compar compar)
{ as_array ().qsort (compar); }
void qsort ()
{ as_array ().qsort (Type::cmp); }
{ as_array ().qsort (); }
/* Unsorted search API. */
template <typename T>