| 567 | } |
| 568 | |
| 569 | iterator insert_after(const_iterator pos, I *const & item) |
| 570 | { |
| 571 | auto root = static_cast<L *>(this); |
| 572 | CHECK_INVALID_ARGUMENT(pos.iter.root == root); |
| 573 | CHECK_INVALID_ARGUMENT(pos.iter.cur); |
| 574 | |
| 575 | auto link = pos.iter.cur; |
| 576 | auto next = link->next; |
| 577 | auto newlink = new L(); |
| 578 | newlink->prev = link; |
| 579 | newlink->next = next; |
| 580 | link->next = newlink; |
| 581 | if (next) |
| 582 | { |
| 583 | next->prev = newlink; |
| 584 | } |
| 585 | newlink->item = item; |
| 586 | item->dfhack_set_list_link(newlink); |
| 587 | return iterator(root, newlink); |
| 588 | } |
| 589 | |
| 590 | void push_front(I *const & item) |
| 591 | { |