You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Besides that, both Vec and VecDeque break references after operations that modify the container at the ends. std::deque allocates blocks of memory, not individual elements, so references stay valid.
I don't think VecDeque can be a good translation because it does not satisfy all complexity requirements and doesn't satisfy the reference validation rules.
Activity
lucic71 commentedon Nov 18, 2026
std::dequeVec(master)VecDequepush_back/emplace_backpush_front/emplace_frontinsert(0, x)shifts everything)pop_backpop_frontremove(0)shifts everything)d[i],at,front,back++,--,+ ninsert(pos, x)/erase(pos)in the middlesize,emptyclear, copyBesides that, both Vec and VecDeque break references after operations that modify the container at the ends. std::deque allocates blocks of memory, not individual elements, so references stay valid.
I don't think VecDeque can be a good translation because it does not satisfy all complexity requirements and doesn't satisfy the reference validation rules.