Closed Quuxplusone closed 2 years ago
Good spotting - fixed in beta, there is a slightly faster solution for the element_pointer line though
Good spotting! fixed in beta, there is a slightly faster solution for the element_pointer line
On 25/04/2022 12:46 pm, Quuxplusone wrote:
|#include "plf_hive.h" #include
int main() { plf::hive h(plf::hive_limits(4, 4)); h.insert(6, 'x'); auto it = h.end(); advance(it, -1); advance(it, -1); assert(it != h.end()); }|
It looks like
advance
with a negative offset can sometimes move forward instead of backward, when it's right at the edge of a block. I think the culprit is here:I think this is assuming that "no erasures in the group" means "the group is full," so we're computing things with
capacity
, but actually the group might be only incompletely full, and we should be usingsize
instead. So the middle two lines should be more like