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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user