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

use emplace_back / emplace where possible #3814

Merged
merged 1 commit into from
Mar 17, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Src/Base/AMReX_BLBackTrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ BLBTer::BLBTer(const std::string& s, const char* file, int line)
std::ostringstream ss0;
ss0 << "Proc. " << ParallelDescriptor::MyProc()
<< ": \"" << s << "\"";
BLBackTrace::bt_stack.push(std::make_pair(ss0.str(), line_file));
BLBackTrace::bt_stack.emplace(ss0.str(), line_file);
#endif
}

Expand Down
9 changes: 3 additions & 6 deletions Src/Base/AMReX_FabArrayBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1325,8 +1325,7 @@ FabArrayBase::RB90::define (const FabArrayBase& fa)
{
Box bxsnd = (n==0) ? amrex::get<0>(dst_to_src)(bxrcv)
: amrex::get<1>(dst_to_src)(bxrcv);
send_tags[dst_owner].push_back(FabArrayBase::CopyComTag(bxrcv, bxsnd,
krcv, ksnd));
send_tags[dst_owner].emplace_back(bxrcv, bxsnd, krcv, ksnd);
}
}
}
Expand Down Expand Up @@ -1498,8 +1497,7 @@ FabArrayBase::RB180::define (const FabArrayBase& fa)
if (dst_owner != myproc) // local copy will be dealt with later
{
Box const& bxsnd = convert(bxrcv);
send_tags[dst_owner].push_back(FabArrayBase::CopyComTag(bxrcv, bxsnd,
krcv, ksnd));
send_tags[dst_owner].emplace_back(bxrcv, bxsnd, krcv, ksnd);
}
}
}
Expand Down Expand Up @@ -1683,8 +1681,7 @@ FabArrayBase::PolarB::define (const FabArrayBase& fa)
if (dst_owner != myproc) // local copy will be dealt with later
{
Box const bxsnd = (n<4) ? convert(bxrcv) : convert_corner(bxrcv);
send_tags[dst_owner].push_back(FabArrayBase::CopyComTag(bxrcv, bxsnd,
krcv, ksnd));
send_tags[dst_owner].emplace_back(bxrcv, bxsnd, krcv, ksnd);
}
}
}
Expand Down
6 changes: 2 additions & 4 deletions Src/Base/AMReX_MPMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,8 @@ Copier::Copier (BoxArray const& ba, DistributionMapping const& dm)
const int oi = isec.first;
const Box& bx = isec.second;
const int orank = oprocs[oi];
m_SndTags[orank].push_back
(FabArrayBase::CopyComTag(bx, bx, oi, i));
m_RcvTags[orank].push_back
(FabArrayBase::CopyComTag(bx, bx, i, oi));
m_SndTags[orank].emplace_back(bx, bx, oi, i);
m_RcvTags[orank].emplace_back(bx, bx, i, oi);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Src/Base/AMReX_ParmParse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ ParmParse::ParmParse (const std::string& prefix)
ParmParse::ParmParse (Table& a_table)
: m_table(a_table)
{
m_pstack.push("");
m_pstack.emplace("");
}

ParmParse::Frame::Frame (ParmParse& pp, const std::string& pfix)
Expand Down
Loading