pub fn index_order_by_key<T, K: Ord>(
    buf: &[T],
    key: impl FnMut((usize, &T)) -> K
) -> Vec<usize>
Expand description

添字の順序。

See index_order_by.

Examples

use std::cmp::Reverse;

use nekolib::algo::index_order_by_key;

let a = [0, 2, 1, 4, 5, 1, 3];
let key = |(i, &ai): (usize, &i32)| (ai, Reverse(i));
assert_eq!(index_order_by_key(&a, key), [0, 5, 2, 1, 6, 3, 4]);