1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:28:12 +00:00
serenity/Userland/Applications/SpaceAnalyzer/Tree.cpp
Arda Cinar 8ba37872e9 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
2023-01-09 17:08:17 +00:00

16 lines
395 B
C++

/*
* 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; });
}
}