std::queueis a container adapter, not the container itself. So compare the overhead of some real containers:
std::vectorvery memory efficient, it uses almost zero overhead. A std::vector<int>uses about 4 bytes per element, on most platforms.
std::listvery memory inefficient, it is likely to use two overhead pointers for each item. A std::list<int>uses about 24 bytes per element on 64-bit platforms and 12 bytes on 32-bit platforms.
std::dequeis between the two, and this is the default container for std::queue. According to “what happens with the excess memory, std::deque” the MSVC decomponent is a list of blocks, each of which contains about 16 bytes, which is quite a bit of overhead if your queues contain one or two inteach and you have many queues.
, , , , . 15 , - , .
, , . , Boost circular_buffer. std::vector std::deque deque. , , STL. , .
.