A simple map based on a vector for small integer keys. Space requirements are O(highest integer key).
smallintmap
map of map::map<uint, V> for smallintmap<V>
- Implements the map::map interface for smallintmapas_map
- Cast the given smallintmap to a map::mapcontains_key
- Returns true if the map contains a value for the specified keyfind
- Get the value for the specified keyget
- Get the value for the specified keyinsert
- Add a value to the mapmk
- Create a smallintmapsmallintmap
type smallintmap<T: copy> = @{v: dvec<option<T>>,}
map of map::map<uint, V> for smallintmap<V>
Implements the map::map interface for smallintmap
size
fn size() -> uint
insert
fn insert(+key: uint, +value: V) -> bool
remove
fn remove(&&key: uint) -> option<V>
clear
fn clear()
contains_key
fn contains_key(&&key: uint) -> bool
get
fn get(&&key: uint) -> V
[]
fn [](&&key: uint) -> V
find
fn find(&&key: uint) -> option<V>
rehash
fn rehash()
each
fn each(it: fn(&&uint, V) -> bool)
each_key
fn each_key(it: fn(&&uint) -> bool)
each_value
fn each_value(it: fn(V) -> bool)
as_map
fn as_map<V: copy>(s: smallintmap<V>) -> map::map<uint, V>
Cast the given smallintmap to a map::map
contains_key
fn contains_key<T: copy>(self: smallintmap<T>, key: uint) -> bool
Returns true if the map contains a value for the specified key
find
fn find<T: copy>(self: smallintmap<T>, key: uint) -> option<T>
Get the value for the specified key. If the key does not exist in the map then returns none
get
fn get<T: copy>(self: smallintmap<T>, key: uint) -> T
Get the value for the specified key
If the key does not exist in the map
insert
fn insert<T: copy>(self: smallintmap<T>, key: uint, val: T)
Add a value to the map. If the map already contains a value for the specified key then the original value is replaced.
mk
fn mk<T: copy>() -> smallintmap<T>
Create a smallintmap