Generalizing to ForwardList<T>?
We now know that we can adapt the implementation of Vector<T>, transforming it from an explicit memory management model to an implicit one, and that so doing has lots of advantages. It is tempting to do the same with other containers, but before embarking on such an adventure, it might be wise to analyze the problem a little.
We implemented a node-based container with explicit memory management named ForwardList<T> in Chapter 12. What would be the impact of trying to change the implementation of this container to make it more implicit?
Attempt - making each node responsible for its successor
In our exploration of ways in which we could try to make memory management in a node-based container more implicit, one possible approach could be to change the definition of ForwardList<T>::Node such that the next data member becomes a std::unique_ptr<Node> instead of a Node*.
As a synopsis, we would get the following:
...