util/RedBlackTree: swap colors when swapping with successor
Swapping was incomplete without swapping the colors; this led to assertion failures under certain conditions.
This commit is contained in:
parent
3cf0896998
commit
88475f2e2b
|
@ -275,6 +275,8 @@ public:
|
||||||
auto &p = *parent;
|
auto &p = *parent;
|
||||||
const auto direction_in_parent = p.GetChildDirection(*this);
|
const auto direction_in_parent = p.GetChildDirection(*this);
|
||||||
|
|
||||||
|
std::swap(color, successor.color);
|
||||||
|
|
||||||
successor.SetChild(Direction::LEFT, GetLeft());
|
successor.SetChild(Direction::LEFT, GetLeft());
|
||||||
SetChild(Direction::LEFT, nullptr);
|
SetChild(Direction::LEFT, nullptr);
|
||||||
SetChild(Direction::RIGHT, successor.GetRight());
|
SetChild(Direction::RIGHT, successor.GetRight());
|
||||||
|
|
Loading…
Reference in New Issue