#include <list>
int main()
{
std::list<int> a(9, 1);
a.push_back(4);
std::list<int> b(1, 2);
std::list<int>::iterator valuesBegin(a.begin());
std::list<int>::iterator valuesEnd(a.end());
--valuesEnd;
std::list<int>::iterator newValuesEnd(b.end());
// This should not have any effect on iterators.
b.splice(newValuesEnd, a, valuesBegin, valuesEnd);
// Checked iterator assertion (a bug).
valuesBegin != newValuesEnd;
// Possible another bug:
// This works for equivalent allocators,
// how about non-equivalent allocators?
std::list<int>::iterator iter(valuesBegin);
while(iter != newValuesEnd)
{
*iter = 3;
++iter;
}
return 0;
}