Macro lib::srt

source ·
macro_rules! srt {
    ($f:expr, $head:expr, $($tail:expr),*) => { ... };
}
Expand description

Sorts the given vectors by the given function. Requires use lib::util::vec::*;

§Examples

use lib::srt;
use lib::util::vec::*;
let mut x = vec![1, 3, 2];
let mut y = vec![3, 2, 1];
srt!(|i, j| x[i] < x[j], y, x);
assert_eq!(x, [1, 2, 3]);
assert_eq!(y, [3, 1, 2]);