[−][src]Macro staticvec::sortedstaticvec
Accepts an array of any primitive Copy
type that has a
PartialOrd
implementation, sorts it, and creates a new
StaticVec
instance from the result in a fully const context compatible
manner.
Example usage:
#![feature(const_fn, const_if_match, const_loop)] // Currently, it's necessary to have the type specified in the macro itself. static V: StaticVec<f64, 3> = sortedstaticvec!(f64, [16.0, 15.0, 14.0]); assert_eq!(V, [14.0, 15.0, 16.0]); assert_eq!(V.reversed().drain(0..1), [16.0]); static VV: StaticVec<f64, 0> = sortedstaticvec!(f64, []); assert_eq!(VV, []);