Rust订购的套装是BTreeSet
:
use std::collections::BTreeSet; // Type inference lets us omit an explicit type signature (which // would be `BTreeSet<&str>` in this example). let mut books = BTreeSet::new(); // Add some books. books.insert("A Dance With Dragons"); books.insert("To Kill a Mockingbird"); books.insert("The Odyssey"); books.insert("The Great Gatsby");
有序 map 是BTreeMap
.
因为集合和映射是有序的,所以应该有一种方法来获得包含的最大和最小元素.你怎么弄到的?