Skip to content

Commit

Permalink
use emplace_back / emplace where possible
Browse files Browse the repository at this point in the history
these were pointed out by clang-tidy
  • Loading branch information
zingale committed Mar 17, 2024
1 parent 54e438a commit 382682c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
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

0 comments on commit 382682c

Please sign in to comment.