<deque>: Make deque::shrink_to_fit never relocate elements by frederick-vs-ja · Pull Request #4091 · microsoft/STL (original) (raw)

I was having an assumption that the deque will be in all-full state. However, after debugging I realize that the _Mapsize() is already 64 (which means the capacity is already (roughly) 256 instead of 128), and _First_block_idx==63 and _Last_block_idx==32, which are not closely related as I originally supposed.

No changes requested, as what's going on here is enough to catch out the bug, and I have no idea how to improve the test here (mainly, how to control the relative position of Firstblockidx and Lastblockidx in an obvious way?). I just want to point out that 128, together with pop-then-push, wrongly gives an impression that deq is in full state and thus it's testing a corner-case - no, this is not a corner case.