Chriscbr / thinset

A data structure for sparse sets of unsigned integers.
Apache License 2.0
2 stars 1 forks source link

Add `SparseMap` as underlying data strucutre #8

Closed thass0 closed 8 months ago

thass0 commented 8 months ago

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.