mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-21 15:01:01 +01:00
[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:
1 parent
05762b2fac
commit
df433afe6c
6 files changed
+11
-46
No files matched your search
+1
-10
@@ -219,12 +219,6 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
|
||||
return false;
|
||||
}
|
||||
|
||||
hb_sorted_array_t<Type> qsort (int (*cmp_)(const void*, const void*))
|
||||
{
|
||||
if (likely (length))
|
||||
hb_qsort (arrayZ, length, this->get_item_size (), cmp_);
|
||||
return hb_sorted_array_t<Type> (*this);
|
||||
}
|
||||
template <typename Compar>
|
||||
hb_sorted_array_t<Type> qsort (Compar compar)
|
||||
{
|
||||
@@ -234,10 +228,7 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
|
||||
}
|
||||
hb_sorted_array_t<Type> qsort ()
|
||||
{
|
||||
//static_assert (hb_enable_if (hb_is_trivially_copy_assignable(Type)), "");
|
||||
if (likely (length))
|
||||
hb_qsort (arrayZ, length, this->get_item_size (), Type::cmp);
|
||||
return hb_sorted_array_t<Type> (*this);
|
||||
return qsort ((int(*)(const void*, const void*)) Type::cmp);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in new issue
Block a user