In addition to the key that points back into sparse, SparseMap also stores some data associated with the key in dense. The data can be anything that's Copy. This way, all numeric types supported as keys should work as values. In addition, types like the unit tuple can be used as values. SparseSet wraps the underlying map and uses () for every value in the map.
The Pair typed used to store key-value pairs is mostly used for improved readability of code. It could be used to implement a similar interface to the Entry type in std::collections::HashMap. The update and get functions are very basic and need further improvement.
In addition to the key that points back into
sparse
,SparseMap
also stores some data associated with the key indense
. The data can be anything that'sCopy
. This way, all numeric types supported as keys should work as values. In addition, types like the unit tuple can be used as values.SparseSet
wraps the underlying map and uses()
for every value in the map.The
Pair
typed used to store key-value pairs is mostly used for improved readability of code. It could be used to implement a similar interface to theEntry
type instd::collections::HashMap
. Theupdate
andget
functions are very basic and need further improvement.