list is that insertion of new items and removal of existing items is cheapprovided that the position of the changes is known the disadvantage is that the list is not easily indexable both vector and list are inefficient for searches throughout this discussionlist refers to the doubly linked list in the stlwhereas list (typeset without the monospace fontrefers to the more general list adt both vector and list are class templates that are instantiated with the type of items that they store both have several methods in common the first three methods shown are actually available for all the stl containersr int sizeconstreturns the number of elements in the container void clear)removes all elements from the container bool emptyconstreturns true if the container contains no elementsand false otherwise both vector and list support adding and removing from the end of the list in constant time both vector and list support accessing the front item in the list in constant time the operations arer void push_backconst object )adds to the end of the list void pop_back)removes the object at the end of the list const object backconstreturns the object at the end of the list ( mutator that returns reference is also providedr const object frontconstreturns the object at the front of the list ( mutator that returns reference is also providedbecause doubly linked list allows efficient changes at the frontbut vector does notthe following two methods are available only for listr void push_frontconst object )adds to the front of the list void pop_front)removes the object at the front of the list the vector has its own set of methods that are not part of list two methods allow efficient indexing the other two methods allow the programmer to view and change the internal capacity these methods arer object operator[int idx )returns the object at index idx in the vectorwith no bounds-checking (an accessor that returns constant reference is also providedr object atint idx )returns the object at index idx in the vectorwith boundschecking (an accessor that returns constant reference is also providedr int capacityconstreturns the internal capacity of the vector (see section for more details void reserveint newcapacity )sets the new capacity if good estimate is availableit can be used to avoid expansion of the vector (see section for more details