From d7643f2c3fe6bdef79755e2594491e02234fd979 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Sun, 1 Nov 2020 00:56:50 -0700 Subject: [PATCH] [tlm_teamd]: Make the destionation for std::transform() to use std::back_inserter() for allocating new space for the copied objects (#1490) Fixes: Azure/sonic-buildimage#5755 Fixes: Azure/sonic-buildimage#5433 Make the destination for std::transform() to use std::back_inserter() for allocating new space for the copied objects --- tlm_teamd/teamdctl_mgr.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tlm_teamd/teamdctl_mgr.cpp b/tlm_teamd/teamdctl_mgr.cpp index 09ef8c109d1a..3ea374c797d4 100644 --- a/tlm_teamd/teamdctl_mgr.cpp +++ b/tlm_teamd/teamdctl_mgr.cpp @@ -145,8 +145,8 @@ bool TeamdCtlMgr::remove_lag(const std::string & lag_name) void TeamdCtlMgr::process_add_queue() { std::vector 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)