2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-10 16:27:43 +00:00

General: Use emplace_back's return value where applicable

emplace_back() returns a reference to the added element, so we can use
that instead of querying right after the emplacement.
This commit is contained in:
Lioncash
2019-09-05 19:36:40 -04:00
parent 8ff9e028c7
commit fa56ba5db6
4 changed files with 20 additions and 25 deletions

View File

@@ -115,11 +115,13 @@ void Toolbar::setVerticalVerts(int height) {
}
void Toolbar::push_back(View* v, unsigned unit) {
if (unit >= m_units)
if (unit >= m_units) {
Log.report(logvisor::Fatal, fmt("unit {} out of range {}"), unit, m_units);
std::vector<ViewChild<View*>>& u = m_children[unit];
u.emplace_back();
u.back().m_view = v;
}
std::vector<ViewChild<View*>>& children = m_children[unit];
auto& child = children.emplace_back();
child.m_view = v;
}
void Toolbar::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub) {