src: Discard usage of std::pair of reference type and rename functions
Refs: #1531
Change-Id: Ief2a525b8fb8addbd491d202d6b02d5db2b41ea4
diff --git a/src/route/routing-table.cpp b/src/route/routing-table.cpp
index 9e2c19c..097e95a 100644
--- a/src/route/routing-table.cpp
+++ b/src/route/routing-table.cpp
@@ -140,8 +140,8 @@
void
RoutingTable::addNextHop(string destRouter, NextHop& nh)
{
- std::pair<RoutingTableEntry&, bool> rte = findRoutingTableEntry(destRouter);
- if (!rte.second)
+ RoutingTableEntry* rteChk = findRoutingTableEntry(destRouter);
+ if (rteChk == 0)
{
RoutingTableEntry rte(destRouter);
rte.getNhl().addNextHop(nh);
@@ -149,22 +149,21 @@
}
else
{
- (rte.first).getNhl().addNextHop(nh);
+ rteChk->getNhl().addNextHop(nh);
}
}
-std::pair<RoutingTableEntry&, bool>
-RoutingTable::findRoutingTableEntry(string destRouter)
+RoutingTableEntry*
+RoutingTable::findRoutingTableEntry(const string destRouter)
{
std::list<RoutingTableEntry>::iterator it = std::find_if(m_rTable.begin(),
m_rTable.end(),
bind(&routingTableEntryCompare, _1, destRouter));
if (it != m_rTable.end())
{
- return std::make_pair(boost::ref((*it)), true);
+ return &(*it);
}
- RoutingTableEntry rteEmpty;
- return std::make_pair(boost::ref(rteEmpty), false);
+ return 0;
}
void