summaryrefslogtreecommitdiffstats
path: root/messagebus
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2018-04-03 18:52:37 +0200
committerHenning Baldersheim <balder@oath.com>2018-04-03 18:52:37 +0200
commit69c50d6c403f1857cbdd081b1d6bf67581e5cbc6 (patch)
treee14389546a248a9f9e88436b64fc9c7dac26449e /messagebus
parent3a3ac3076768aff1abaa055d3191c3672725cc77 (diff)
Use emplace instead of older insert.
Diffstat (limited to 'messagebus')
-rw-r--r--messagebus/src/vespa/messagebus/routing/routingtable.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/messagebus/src/vespa/messagebus/routing/routingtable.cpp b/messagebus/src/vespa/messagebus/routing/routingtable.cpp
index 5885eb2b67c..c5b63f9e362 100644
--- a/messagebus/src/vespa/messagebus/routing/routingtable.cpp
+++ b/messagebus/src/vespa/messagebus/routing/routingtable.cpp
@@ -12,16 +12,12 @@ namespace mbus {
RoutingTable::HopIterator::HopIterator(const std::map<string, HopBlueprint> &hops) :
_pos(hops.begin()),
_end(hops.end())
-{
- // empty
-}
+{ }
RoutingTable::RouteIterator::RouteIterator(const std::map<string, Route> &routes) :
_pos(routes.begin()),
_end(routes.end())
-{
- // empty
-}
+{ }
RoutingTable::RoutingTable(const RoutingTableSpec &spec) :
_name(spec.getProtocol()),
@@ -30,7 +26,7 @@ RoutingTable::RoutingTable(const RoutingTableSpec &spec) :
{
for (uint32_t i = 0; i < spec.getNumHops(); ++i) {
const HopSpec& hopSpec = spec.getHop(i);
- _hops.insert(std::map<string, HopBlueprint>::value_type(hopSpec.getName(), HopBlueprint(hopSpec)));
+ _hops.emplace(hopSpec.getName(), HopBlueprint(hopSpec));
}
for (uint32_t i = 0; i < spec.getNumRoutes(); ++i) {
Route route;
@@ -38,7 +34,7 @@ RoutingTable::RoutingTable(const RoutingTableSpec &spec) :
for (uint32_t j = 0; j < routeSpec.getNumHops(); ++j) {
route.addHop(Hop(routeSpec.getHop(j)));
}
- _routes.insert(std::map<string, Route>::value_type(routeSpec.getName(), std::move(route)));
+ _routes.emplace(routeSpec.getName(), std::move(route));
}
}
@@ -64,7 +60,7 @@ RoutingTable::hasRoute(const string &name) const
const Route *
RoutingTable::getRoute(const string &name) const
{
- std::map<string, Route>::const_iterator it = _routes.find(name);
+ auto it = _routes.find(name);
return it != _routes.end() ? &(it->second) : nullptr;
}