Why doesn't std :: queue implement insert (), but does std :: deque do?

I read std::queue, and I was wondering why there is no way to effectively insert multiple elements with one operation, but std::dequesuggests std::deque::insert?

+4
source share
2 answers

Insert allows you to insert into an arbitrary position in the structure.

std::queue- An abstract interface for the FIFO structure. You can add only things to the end. The base structure does not necessarily have an effective way to insert into an arbitrary position (for example, consider std::vector). Therefore, it std::queuedoes not have common member functions of the insert.

, , . , .

+1

std::queue - , push/pop. insert, std::vector .

, : , , , .

0

Source: https://habr.com/ru/post/1677973/


All Articles