This increases the container size by the amount of elements inserted, and reduces the size of x by the same amount ( whenever x is not the same as *this ).
The operation does not involve the construction or destruction of any element object and, except for the third version, it is performed in constant time.
The iterators that pointed to moved elements are no longer valid.
Parameters
- position
- Position within the container where the elements of x are inserted.
iterator is a member type, defined as a bidirectional iterator. - x
- A list object containing the same type of objects as this container.
This parameter may be *this if position points to an element not actually being spliced: for the first version, this is never the case, but for the other versions this is possible. - i
- Iterator to an element in x. Only this single element is moved.
iterator is a member type, defined as a bidirectional iterator type. - first,last
- Iterators specifying a range of elements in x. Moves the elements in the range [first,last) to position.
Notice that the range includes all the elements between first and last, including the element pointed by first but not the one pointed by last.
iterator is a member type, defined as a bidirectional iterator type.
Return value
noneExample
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
|
Output:
mylist1 contains: 30 3 4 1 10 20 mylist2 contains: 2 |
Complexity
Constant on all cases, except when x is a list object different than *this in the third function version, in which case it is linear in the range between first and last (iterator advance).See also
| list::insert | Insert elements (public member function) |
| list::merge | Merge sorted lists (public member function) |
| list::erase | Erase elements (public member function) |
