void list<T,Allocator>::splice ( iterator position, list<T,Allocator>& x, iterator i ); void list<T,Allocator>::splice ( iterator position, list<T,Allocator>& x, iterator start, iterator finish );
It's pretty hard to see by looking at it, because we have 2 lists and 2 iterators.
The word position gives it away. It indicates where to execute insert .
The iterator that is i is what moves. In the second overload, the range moves from start to finish , but not finish . finish may be the end of the list.
position must belong to the this list. The iterator must belong to list x . Elements are inserted immediately before position in the source list (of this) and at the same time are removed from the x list.
Please note that cplusplus.com claims that iterators become invalid after splicing, but in fact this is not so, they remain valid.
cplusplus.com is correct in that position may not be one of the spliced elements (in case the lists match)
In your example:
mylist1.splice ( mylist1.begin(), mylist1, it, mylist1.end());
it should be an iterator in mylist1. It looks like this should not be mylist1.begin() .
Your operation moves all items from it forward to the beginning of the list.