Sorry, I just noticed:
std::deque
should be:
std::list
Because std::deque introduces extra complexity to implement random access. It's actually implemented as a red-black tree like std::map or std::set. But since we're not using random access and only need head/tail insertion and removal, a simple doubly linked list (std::list) will be faster and smaller.
This proposal is still much larger than it should be. It's an itch I have to scratch but I'm trying not to push the point too much. :/
Sorry, I just noticed:
std::deque
should be:
std::list
Because std::deque introduces extra complexity to implement random access. It's actually implemented as a red-black tree like std::map or std::set. But since we're not using random access and only need head/tail insertion and removal, a simple doubly linked list (std::list) will be faster and smaller.
This proposal is still much larger than it should be. It's an itch I have to scratch but I'm trying not to push the point too much. :/