| 4 | #include <stdlib.h> |
| 5 | |
| 6 | static int compare(const void *lhs, const void *rhs) { |
| 7 | auto &a = *reinterpret_cast<const S *>(lhs); |
| 8 | auto &b = *reinterpret_cast<const S *>(rhs); |
| 9 | |
| 10 | if (a.key1 < b.key1) |
| 11 | return -1; |
| 12 | |
| 13 | if (a.key1 > b.key1) |
| 14 | return 1; |
| 15 | |
| 16 | if (a.key2 < b.key2) |
| 17 | return -1; |
| 18 | |
| 19 | if (a.key2 > b.key2) |
| 20 | return 1; |
| 21 | |
| 22 | return 0; |
| 23 | } |
| 24 | |
| 25 | void solution(std::array<S, N> &arr) { |
| 26 | qsort(arr.data(), arr.size(), sizeof(S), compare); |
nothing calls this directly
no outgoing calls
no test coverage detected