blob: 582e49e2482d9619a8cc340c80a07df9d4b8a576 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#include <stdlib/quicksort.h>
constexpr bool is_sorted(int a[], size_t from, size_t to) {
for (; from < to - 1; ++from)
if (a[from] > a[from + 1])
return false;
return true;
}
static_assert([]() {
int a[] = {12, 82, 347, 92, 74, 123, 0, 56};
const size_t a_len = sizeof(a) / sizeof(int);
qsort(a, 0, a_len - 1);
return is_sorted(a, 0, a_len - 1);
}());
|