![]() See deque diagramĪlso, a bit of code to illustrate: // PushBack appends an element to the back of the queue. The ring-buffer based queue reuses memory by wrapping its storage around: As the queue grows beyond one end of the underlying slice, it adds additional nodes to the other end of the slice. ![]() This is what is discussed in the rest of this post. ![]() So, as a general recommendation I would recommend a ring-buffer based queue implementation. They are just as efficient adding and removing items from either end so you naturally get a double-ended queue. Fewer allocations means better performance.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |