as an internal storage for another type. It is something like Vec, but stores 3 different internal arrays (within one buffer), and it has limited list of operations that it supports.
I wonder if I made it correctly, and it can be safely used.
https://github.com/gameraccoon/sparse_set_container/blob/manual-memory-management/src/storage.rs
It looks sound to me, but I may have missed something obvious
the naming is quite confusing(I generally implement is with index and data arrays rather than dense and sparse arrays, having dense array in sparse storage just feels confusing) for me But otherwise at a glance it seems fine you could write tests or borrow some tests from comparable libraries and try those.
Only Why start the start_ptr's out as dangling? Why not null_mut like the buffer ptr?
Slices require a properly aligned pointer even when the size is empty, so to avoid explicit zero checks I had to use "dangling" which would provide such an aligned pointer. For buffer there's no requirements, so I just left it null
Обсуждают сегодня