Skip to content

Commit d7643f2

Browse files
[tlm_teamd]: Make the destionation for std::transform() to use std::back_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
1 parent 7fa7cd6 commit d7643f2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tlm_teamd/teamdctl_mgr.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ bool TeamdCtlMgr::remove_lag(const std::string & lag_name)
145145
void TeamdCtlMgr::process_add_queue()
146146
{
147147
std::vector<std::string> lag_names_to_add;
148-
std::transform(m_lags_to_add.begin(), m_lags_to_add.end(), lag_names_to_add.begin(), [](auto pair) { return pair.first; });
149-
for (const auto lag_name: lag_names_to_add)
148+
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; });
149+
for (const auto & lag_name: lag_names_to_add)
150150
{
151151
bool result = try_add_lag(lag_name);
152152
if (!result)

0 commit comments

Comments
 (0)