adjacency-list: fix crash in equals operator
some minor code improvements
refs: #4705
Change-Id: I28805981a88a94c79f699956bb7e62a268d9ba49
diff --git a/src/adjacent.cpp b/src/adjacent.cpp
index 183dcef..950a7ae 100644
--- a/src/adjacent.cpp
+++ b/src/adjacent.cpp
@@ -75,8 +75,9 @@
bool
Adjacent::operator<(const Adjacent& adjacent) const
{
- return (m_name < adjacent.getName()) ||
- (m_linkCost < adjacent.getLinkCost());
+ auto linkCost = adjacent.getLinkCost();
+ return std::tie(m_name, m_linkCost) <
+ std::tie(adjacent.getName(), linkCost);
}
std::ostream&