#include <list>
using namespace std;
int main()
{
// The same fatal errors are present with
// all of the stl containers.
typedef list<int> Container;
Container a;
Container b;
// It doesn't matter whether there is data
// in the containers or not.
//a.push_back(1);
//b.push_back(1);
{
// Case 1:
// Comparing iterators from different containers
// gives a fatal error. Sounds rational, although
// the error diagnostics could be better.
// Fatal error
//a.begin() == b.begin();
}
{
// Case 2:
// The following is guaranteed to be
// legal by the standard.
Container::iterator i(a.begin());
a.swap(b);
Container::iterator j(b.begin());
// Fatal error
i == j;
}
return 0;
}