In reply to dave_59:
Thanks, I didn’t know that the internal structure of queue would not per se require reallocation if some size would be exceeded (unlike in some other languages).
The caller of the function is using push_back, hence the function logically also uses a queue.