[algs] Assert trivial copy assignable in stable_sort

This commit is contained in:
Behdad Esfahbod 2022-11-21 08:52:33 -07:00
parent 9bb39423f5
commit 70a5cd53f6
1 changed files with 3 additions and 0 deletions

View File

@ -1156,6 +1156,9 @@ hb_qsort (void *base, size_t nel, size_t width,
template <typename T, typename T2, typename T3 = int> static inline void
hb_stable_sort (T *array, unsigned int len, int(*compar)(const T2 *, const T2 *), T3 *array2 = nullptr)
{
static_assert (hb_is_trivially_copy_assignable (T), "");
static_assert (hb_is_trivially_copy_assignable (T3), "");
for (unsigned int i = 1; i < len; i++)
{
unsigned int j = i;