14.3. std::forward_listΒΆ
Like list, the forward_list is a container that stores elements in nodes A forward list only defines pointers to the next node in the list. This means that a forward list can only be traversed in the direction of the tail.
The defining operations of a forward_list are:
- push_front
Add a new element to the beginning of the list.
- pop_front
Remove an element from the beginning of the list.
- front
Get the value of the element at the beginning of the list.
Compared to list this container provides more space efficient storage when bidirectional iteration is not needed. A very light-weight container, it does not have any overhead compared to its implementation in C.
More to Explore