c++ - How is the memory use in a queue? -


In my project I use std :: queue class. I would like to know what will happen if I do the following.

  • Get an indicator of an element inside the queue (note: not an indicator and not a single door).
  • I am enlarging in line like push and pop (pop element not indicated by previous pointer)

Is my pointer still the same? Point to the element that I specify at the beginning? Is it defined by the queue specification?

std :: queue uses a sequence container for its implementation By default, std :: deque is used with std :: deque , as long as all the inclusions and erasures are at the beginning or end of the container, the container's The references and signs of the elements are not invalid.

However, I do not know how you will get an indicator for an element in the queue; It does not provide functionality for this (you can only find references to the first and last elements in the queue).


Comments