1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/// Sort a list, and synchronize swapping to other parallel vecs.
///
/// This is used internally by [`crate::notes::ShortNoteGroup`] to keep its struct-of-arrays
/// components in the same order after sorting one index slice.
///
/// This currently allocates temporary permutation storage proportional to `list.len()`.
///
/// # Examples
/// ```
/// use vsrg::collections::sort_multi;
///
/// let mut keys = vec![3, 1, 2];
/// let mut values = vec!["three", "one", "two"];
///
/// sort_multi(&mut keys, |i, j| values.swap(i, j));
///
/// assert_eq!(keys, [1, 2, 3]);
/// assert_eq!(values, ["one", "two", "three"]);
/// ```