]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
monc: Remove pessimizing move
authorAdam C. Emerson <aemerson@redhat.com>
Mon, 10 Apr 2017 15:48:57 +0000 (11:48 -0400)
committerAdam C. Emerson <aemerson@redhat.com>
Tue, 11 Apr 2017 01:57:14 +0000 (21:57 -0400)
Calling std::move on on a function returning a value can interfere
with RVO. At best it has no effect, but can actively interfere with
Copy/Move Elision and make code less efficient.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/mon/MonClient.cc

index 684b3f617b568cd9e0bc921411fa3e928be064d9..b8ceab714be41353d1f849457574e23bf1538bdc 100644 (file)
@@ -623,7 +623,7 @@ MonConnection& MonClient::_add_conn(unsigned rank, uint64_t global_id)
   auto peer = monmap.get_addr(rank);
   auto conn = messenger->get_connection(monmap.get_inst(rank));
   MonConnection mc(cct, conn, global_id);
-  auto inserted = pending_cons.insert(move(make_pair(peer, move(mc))));
+  auto inserted = pending_cons.insert(make_pair(peer, move(mc)));
   ldout(cct, 10) << "picked mon." << monmap.get_name(rank)
                  << " con " << conn
                  << " addr " << conn->get_peer_addr()