Skip to content

Commit

Permalink
[tlm_teamd]: Make the destionation for std::transform() to use std::b…
Browse files Browse the repository at this point in the history
…ack_inserter() for allocating new space for the copied objects (sonic-net#1490)

Fixes: sonic-net#5755
Fixes: sonic-net#5433

Make the destination for std::transform() to use std::back_inserter() for allocating new space for the copied objects
  • Loading branch information
pavel-shirshov committed Nov 1, 2020
1 parent 7fa7cd6 commit d7643f2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tlm_teamd/teamdctl_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ bool TeamdCtlMgr::remove_lag(const std::string & lag_name)
void TeamdCtlMgr::process_add_queue()
{
std::vector<std::string> lag_names_to_add;
std::transform(m_lags_to_add.begin(), m_lags_to_add.end(), lag_names_to_add.begin(), [](auto pair) { return pair.first; });
for (const auto lag_name: lag_names_to_add)
std::transform(m_lags_to_add.begin(), m_lags_to_add.end(), std::back_inserter(lag_names_to_add), [](const auto & pair) { return pair.first; });
for (const auto & lag_name: lag_names_to_add)
{
bool result = try_add_lag(lag_name);
if (!result)
Expand Down

0 comments on commit d7643f2

Please sign in to comment.