Chriscbr / thinset

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

Relax SparseMap's Copy constraint, change `SparseMap::remove`, add examples #23

Closed Chriscbr closed 9 months ago

Chriscbr commented 9 months ago

The Copy constraint on values seemed like it was necessary at some point, but at least from what I can see, there's no hard requirement on it. The only possible limitation is that SparseMap::update needs to accept a Fn(&V) -> V instead of Fn(V) -> V since it's not possible to safely map and replace a value at the same time (https://stackoverflow.com/questions/67461269/replace-a-value-behind-a-mutable-reference-by-moving-and-mapping-the-original).

Breaking changes:

Chriscbr commented 9 months ago

(I should break some of these changes into separate PRs, don't follow my coding practices too closely...)