[−][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)] use staticvec::{sortedstaticvec, StaticVec}; // 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]); const V2: StaticVec<usize, 4> = sortedstaticvec!(usize, [16, 15, 14, 13]); assert_eq!(V2, [13, 14, 15, 16]);