Maybe I didn't clearly make my point: I suspect that the standard should
be changed to explicitly say that the iterator returned by before_begin
can be invalidated by swap. Assuming that is the case, do we have to go
through special contortions in forward_list? Also note that in all my
tests just incrementing such iterator after the swap leads to a behavior
in debug mode indistinguishable from normal-mode. Eg, things like:
std::forward_list<int> fl1(10, 0);
std::forward_list<int> fl2(10, 1);
auto it1_b = fl1.before_begin();
auto it1_e = fl1.end();
fl1.swap(fl2);
++it1_b;
for (auto it = it1_b; it != it1_e; ++it)
std::cout<< *it<< std::endl;
work already perfectly well. I'm not convinced we need all that code in
<forward_list>.