{
const ERRCODE DONT_EXCHANGE_DELETED =
"Can't exchange deleted elements of lists";
#ifndef NDEBUG
if (!this)
if (!list)
if (!other_it)
if (!(other_it->list))
#endif
(other_it->list->
empty ()) || (current == other_it->current))
return;
if (!current || !other_it->current)
if ((next == other_it->current) ||
(other_it->next == current)) {
if ((next == other_it->current) &&
(other_it->next == current)) {
prev = next = current;
other_it->prev = other_it->next = other_it->current;
}
else {
if (other_it->next == current) {
other_it->prev->next = current;
other_it->current->next = next;
current->next = other_it->current;
other_it->next = other_it->current;
prev = current;
}
else {
prev->next = other_it->current;
current->next = other_it->next;
other_it->current->next = current;
next = current;
other_it->prev = other_it->current;
}
}
}
else {
prev->next = other_it->current;
current->next = other_it->next;
other_it->prev->next = current;
other_it->current->next = next;
}
if (list->last == current)
list->last = other_it->current;
if (other_it->list->last == other_it->current)
other_it->list->last = current;
if (current == cycle_pt)
cycle_pt = other_it->cycle_pt;
if (other_it->current == other_it->cycle_pt)
other_it->cycle_pt = cycle_pt;
old_current = current;
current = other_it->current;
other_it->current = old_current;
}