Closed TimDiekmann closed 3 years ago
Personally I don't have a strong opinion on this.
I think that we should continue allowing this for consistency with our stance on ZSTs.
With that said, the equal case should be considered niche so there is no requirement for the allocator to handle it efficiently. This means that the allocator should not specifically check for new_size == layout.size()
but instead just blindly allocate a new block and copy the contents of the old block into it.
I think that we should continue allowing this for consistency with our stance on ZSTs.
Probably this.
With that said, the equal case should be considered niche so there is no requirement for the allocator to handle it efficiently. This means that the allocator should not specifically check for
new_size == layout.size()
but instead just blindly allocate a new block and copy the contents of the old block into it.
We really should remove the check and do a perf-run. This should improve performance at least a little bit, as less code has to be optimized out.
Currently, it requires, that the new size must be greater/smaller or equal to the current size. This is because the trait also supports ZSTs, as growing an array of ZSTs will still result in a size of zero. I propose to restrict this clause to
Let's discuss/vote which constraint makes more sense.