[algs] Assert trivial copy assignable in stable_sort

pull/3885/head
Behdad Esfahbod 2 years ago
parent 9bb39423f5
commit 70a5cd53f6
  1. 3
      src/hb-algs.hh

@ -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 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) 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++) for (unsigned int i = 1; i < len; i++)
{ {
unsigned int j = i; unsigned int j = i;

Loading…
Cancel
Save