Is there any reason why the standardization committee decided to implement the API std::forward_listso that it does not meet the requirements of the container concept Sequence?
The conceptual requirements Sequencestate that the container must be compatible with expressions such as:
c.insert(it, v); // insert at position
c.insert(it, n, v); // fill insert
c.insert(it, begin, end); // insert range
... where itis an iterator, vis an element, a nis an integer, and a begin/endis a range of iterators.
There is no reason this API is not possible with a singly linked list, because functions insertrequire an iterator starting position. But for some reason, it std::forward_listhas features insert_afterthat violate compatibility with the Sequence concept.
Is there a reason for this?
Siler source
share