The code in the messages class makes several assumptions how std::forward_list is implemented which are not guaranteed by the standard. It fails, e.g. with Microsoft's STL implementation.
- Use of container A's iterator for container B after a move or merge of elements of A into B. This is not allowed for any STL container.
- Use of B's before_begin sentinel iterator for A after B has been moved-assigned to A. Like the other iterators, the before_begin iterator is specific their container. MS STL's implementation is probably the only correct here since the before_begin iterator has no precondition an should still be valid after its content has been replaced by a move-assignment.
Remove dependence on implementation details by restoring the last_ from the container's own iterators.