Forward Lists
A forward list is the primitive form of the list structure we studied in the previous lesson. Nevertheless, forward lists are still useful.
We'll cover the following...
std::forward_list is a singly linked list, which needs the header <forward_list>. std::forward_list has a drastically reduced interface and is optimized for minimal memory requirements.
std::forward_list has a lot in common with std::list:
- It doesn’t support the random access.
- The access of an arbitrary element is slow because in the worst case, we have to iterate forward through the whole list.
- To add or remove an element is fast, if the iterator points to the right place.
- If we add or remove
Ask