Skip to content

Commit

Permalink
Use push_back instead of emplace_back
Browse files Browse the repository at this point in the history
Since we can't have the performance improvements provided by
emplace_back and its construct-in-place mechanism without adding a lot
of code (constructors for the struct), just use push_back to emphasize
the fact that we are constructing the objects then putting them into the
list.
This is fine though, we don't actually need performance in this case.
  • Loading branch information
wawanbreton committed Jul 3, 2024
1 parent 63e7ce2 commit 35e0245
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/PrimeTower/PrimeTower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ PrimeTower::PrimeTower()
const double brim_radius_factor = std::pow((1.0 - static_cast<double>(z) / static_cast<double>(base_height)), base_curve_magnitude);
const coord_t extra_radius = std::llrint(static_cast<double>(base_extra_radius) * brim_radius_factor);
const coord_t total_radius = tower_radius + extra_radius;
base_occupied_outline_.emplace_back(OccupiedOutline{ PolygonUtils::makeDisc(middle_, total_radius, circle_definition_), total_radius });
base_occupied_outline_.push_back(OccupiedOutline{ PolygonUtils::makeDisc(middle_, total_radius, circle_definition_), total_radius });
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/PrimeTower/PrimeTowerInterleaved.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ std::map<LayerIndex, std::vector<PrimeTower::ExtruderToolPaths>> PrimeTowerInter
{
if (toolpaths_at_layer.empty())
{
toolpaths_at_layer.emplace_back(ExtruderToolPaths{ last_extruder_support, ClosedLinesSet(), prime_next_outer_radius, inner_support_radius });
toolpaths_at_layer.push_back(ExtruderToolPaths{ last_extruder_support, ClosedLinesSet(), prime_next_outer_radius, inner_support_radius });
}

ExtruderToolPaths& last_extruder_toolpaths = toolpaths_at_layer.back();
Expand Down Expand Up @@ -117,7 +117,7 @@ void PrimeTowerInterleaved::polishExtrudersUses(LayerVector<std::vector<Extruder
// Make sure we always have something to print
if (extruders_use_at_layer.empty())
{
extruders_use_at_layer.emplace_back(ExtruderUse{ last_used_extruder, ExtruderPrime::Support });
extruders_use_at_layer.push_back(ExtruderUse{ last_used_extruder, ExtruderPrime::Support });
}
else if (std::all_of(
extruders_use_at_layer.begin(),
Expand Down

0 comments on commit 35e0245

Please sign in to comment.