Timeline for C++ Deque Implementation
Current License: CC BY-SA 4.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 16, 2024 at 20:06 | comment | added | G. Sliepen |
Yes, std::deque is different. To quote cppreference.com: "The storage of a deque is automatically expanded and contracted as needed." This description is different from that of std::vector, which mentions it is only "being expanded as needed."
|
|
| Jan 16, 2024 at 19:30 | comment | added | jdav22 |
Thanks @G. Sliepen for the thoughtful review! Only thing I was a bit confused about is the memory leak comment. It's true I don't free blocks until the data structure is destroyed, but isn't this true of STL data structures in general? For example, I thought std::vector doesn't free up memory when you call pop_back(), it only destroys the element you popped, unless you call shrink_to_fit (which might not even shrink the vector as requested). Is std::deque different and it cleans up after itself in some way before deletion?
|
|
| Jan 16, 2024 at 19:20 | vote | accept | jdav22 | ||
| Jan 15, 2024 at 22:28 | history | edited | G. Sliepen | CC BY-SA 4.0 |
added 498 characters in body
|
| Jan 15, 2024 at 22:21 | history | answered | G. Sliepen | CC BY-SA 4.0 |