1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:47:35 +00:00

SpaceAnalyzer: Remove an unnecessary level of inheritance

The TreeMapNode and TreeMap structs inside TreeMapWidget.h both had
single implementers, TreeNode and Tree inside main.cpp. The indirection
was removed and the new structures were moved to their own file
This commit is contained in:
Arda Cinar 2022-12-11 22:45:11 +03:00 committed by Sam Atkins
parent f476b827de
commit 8ba37872e9
6 changed files with 84 additions and 74 deletions

View file

@ -0,0 +1,16 @@
/*
* Copyright (c) 2022, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "Tree.h"
#include <AK/QuickSort.h>
void TreeNode::sort_children_by_area() const
{
if (m_children) {
Vector<TreeNode>* children = const_cast<Vector<TreeNode>*>(m_children.ptr());
quick_sort(*children, [](auto& a, auto& b) { return b.m_area < a.m_area; });
}
}