Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unneeded reserve() calls #391

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions trajopt_sco/include/trajopt_sco/expr_ops.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ inline void exprInc(AffExpr& a, double b) { a.constant += b; }
inline void exprInc(AffExpr& a, const AffExpr& b)
{
a.constant += b.constant;
a.coeffs.reserve(a.coeffs.size() + b.coeffs.size());
a.coeffs.insert(a.coeffs.end(), b.coeffs.begin(), b.coeffs.end());
a.vars.reserve(a.vars.size() + b.vars.size());
a.vars.insert(a.vars.end(), b.vars.begin(), b.vars.end());
}
inline void exprInc(AffExpr& a, const Var& b) { exprInc(a, AffExpr(b)); }
Expand All @@ -36,11 +34,8 @@ inline void exprInc(QuadExpr& a, const AffExpr& b) { exprInc(a.affexpr, b); }
inline void exprInc(QuadExpr& a, const QuadExpr& b)
{
exprInc(a.affexpr, b.affexpr);
a.coeffs.reserve(a.coeffs.size() + b.coeffs.size());
a.coeffs.insert(a.coeffs.end(), b.coeffs.begin(), b.coeffs.end());
a.vars1.reserve(a.vars1.size() + b.vars1.size());
a.vars1.insert(a.vars1.end(), b.vars1.begin(), b.vars1.end());
a.vars2.reserve(a.vars2.size() + b.vars2.size());
a.vars2.insert(a.vars2.end(), b.vars2.begin(), b.vars2.end());
}

Expand Down
Loading