Improve and simplify code with modern C++ features
Change-Id: I83bf5513c2a1f90ba5a59e93c473306864b27d94
diff --git a/rib/fib-updater.cpp b/rib/fib-updater.cpp
index 76a33c7..1d6328c 100644
--- a/rib/fib-updater.cpp
+++ b/rib/fib-updater.cpp
@@ -654,13 +654,11 @@
}
// Remove inherited routes from current namespace
- for (Rib::RouteSet::const_iterator removeIt = routesToRemove.begin();
- removeIt != routesToRemove.end(); )
- {
+ for (auto removeIt = routesToRemove.begin(); removeIt != routesToRemove.end(); ) {
// If a route on the namespace has the same face ID and child inheritance set,
// ignore this route
if (entry.hasChildInheritOnFaceId(removeIt->faceId)) {
- routesToRemove.erase(removeIt++);
+ removeIt = routesToRemove.erase(removeIt);
continue;
}
@@ -674,11 +672,10 @@
}
// Add inherited routes to current namespace
- for (Rib::RouteSet::const_iterator addIt = routesToAdd.begin(); addIt != routesToAdd.end(); ) {
-
+ for (auto addIt = routesToAdd.begin(); addIt != routesToAdd.end(); ) {
// If a route on the namespace has the same face ID and child inherit set, ignore this face
if (entry.hasChildInheritOnFaceId(addIt->faceId)) {
- routesToAdd.erase(addIt++);
+ addIt = routesToAdd.erase(addIt);
continue;
}