Skip to content

Latest commit

 

History

History
1 lines (1 loc) · 434 Bytes

9.21.md

File metadata and controls

1 lines (1 loc) · 434 Bytes

The member function insert(p, t) has the same effect on both list and vector containers, but the cost is different. Inserting an element into list is cheap, while inserting an element into vector will cause all the elements after the newly inserted element be moved. Thus every time the while loop body is excuted, all elements in the vector are moved backward, and new element is inserted in the front of the vector.