diff options
author | Oskar Haarklou Veileborg <ohv1020@hotmail.com> | 2022-11-16 14:38:21 +0100 |
---|---|---|
committer | Oskar Haarklou Veileborg <ohv1020@hotmail.com> | 2022-11-17 14:04:17 +0100 |
commit | 4c1cce6d936d0389ac994e777d2d7d31901ac4c2 (patch) | |
tree | ff82f4ab470e22f304c67c0894016ad0f4879e29 /sets.go | |
parent | Merge pull request #24 from banks/patch-1 (diff) | |
download | pds-4c1cce6d936d0389ac994e777d2d7d31901ac4c2.tar.gz pds-4c1cce6d936d0389ac994e777d2d7d31901ac4c2.tar.xz |
Allow lists to contain non-comparable elements
The current design uses comparability of elements only to detect vacant
entries in leaf node children lists, using the zero value of the
element type as "vacant".
The reason we care about vacant entries is to avoid copy operations in
certain Slice calls. If the entries are not vacant, we have to "zero"
the entries in the returned slice to remove references to allocated
memory.
Therefore, (hackily) treating the zero value as vacant works because the
zero value for pointers is nil (it does not reference anything).
However, requiring the list elements to be comparable is inconvenient.
There shouldn't be a type bound on the elements of a general purpose
list.
With this change vacancy is kept track of with a bitset in list leaf nodes.
Diffstat (limited to 'sets.go')
0 files changed, 0 insertions, 0 deletions