Function rs::float_ord::sort

source · []
pub fn sort<T>(v: &mut [T]) where
    FloatOrd<T>: Ord
Expand description

Sort a slice of floats.

Allocation behavior

This routine uses a quicksort implementation that does not heap allocate.

Example

use rs::float_ord;
let mut v = [-5.0, 4.0, 1.0, -3.0, 2.0];

float_ord::sort(&mut v);
assert!(v == [-5.0, -3.0, 1.0, 2.0, 4.0]);