CreateVector of VariableBlockVector is broken
VariableBlockVector
can be initialized by iterating over the blocks with a CreateIterator
and setting the block sizes. This can be done by either calling the method setblocksize(int)
on the iterator or by assigning the block size to the dereferenced iterator. The allocation is handled in the prefix operator++()
. The iterator claims to be an output iterator, but it is in fact not even that, because assignment to the result of the postfix operator++(int)
will fail to correctly initialize blocks. This became apparent when I replaced a call to std::fill()
in the test suite with std::fill_n()
, which calls the postfix operator. By assigning to the result of the postfix operator, the block size is stored in the temporary iterator returned by the postfix operator, and as that temporary is thrown away without ever having its prefix operator++()
called, the corresponding block is never allocated.
AFAICT, the only real way of fixing this would be to cache the assigned block sizes in the VariableBlockVector
instead of storing them in the iterator and to delay the block allocation until the iterator reaches the end state. This would, however, change the behavior of the vector.
I don't really use this thing, could someone with more experience perhaps chime in?